slidge_whatsapp.command

Classes

Logout

Abstract base class to implement gateway commands (chatbot and ad-hoc)

PairPhone

Abstract base class to implement gateway commands (chatbot and ad-hoc)

ChangePresence

Abstract base class to implement gateway commands (chatbot and ad-hoc)

SubscribeToPresences

Abstract base class to implement gateway commands (chatbot and ad-hoc)

Module Contents

class slidge_whatsapp.command.Logout(xmpp)[source]

Bases: slidge.command.Command

Abstract base class to implement gateway commands (chatbot and ad-hoc)

Parameters:

xmpp (slidge.core.gateway.BaseGateway)

NAME = '🔓 Disconnect from WhatsApp'[source]

Friendly name of the command, eg: “do something with stuff”

HELP = "Disconnects active WhatsApp session without removing any linked device credentials. To...[source]

Long description of what the command does

NODE = 'wa_logout'[source]

Name of the node used for ad-hoc commands

CHAT_COMMAND = 'logout'[source]

Text to send to the gateway to trigger the command via a message

ACCESS[source]

Who can use this command

async run(session, ifrom, *args)[source]

Entry point of the command

Parameters:
  • session (Optional[slidge_whatsapp.session.Session]) – If triggered by a registered user, its slidge Session

  • ifrom (slixmpp.JID) – JID of the command-triggering entity

  • args – When triggered via chatbot type message, additional words after the CHAT_COMMAND string was passed

Returns:

Either a TableResult, a Form, a Confirmation, a text, or None

Return type:

str

class slidge_whatsapp.command.PairPhone(xmpp)[source]

Bases: slidge.command.Command

Abstract base class to implement gateway commands (chatbot and ad-hoc)

Parameters:

xmpp (slidge.core.gateway.BaseGateway)

NAME = '📱 Complete registration via phone number'[source]

Friendly name of the command, eg: “do something with stuff”

HELP = 'As an alternative to QR code verification, this allows you to complete registration by inputing...[source]

Long description of what the command does

NODE = 'wa_pair_phone'[source]

Name of the node used for ad-hoc commands

CHAT_COMMAND = 'pair-phone'[source]

Text to send to the gateway to trigger the command via a message

ACCESS[source]

Who can use this command

async run(session, ifrom, *args)[source]

Entry point of the command

Parameters:
  • session (Optional[slidge_whatsapp.session.Session]) – If triggered by a registered user, its slidge Session

  • ifrom (slixmpp.JID) – JID of the command-triggering entity

  • args – When triggered via chatbot type message, additional words after the CHAT_COMMAND string was passed

Returns:

Either a TableResult, a Form, a Confirmation, a text, or None

Return type:

slidge.command.Form

static finish(form_values, session, _ifrom)[source]
Async:

Parameters:
class slidge_whatsapp.command.ChangePresence(xmpp)[source]

Bases: slidge.command.Command

Abstract base class to implement gateway commands (chatbot and ad-hoc)

Parameters:

xmpp (slidge.core.gateway.BaseGateway)

NAME = '📴 Set WhatsApp web presence'[source]

Friendly name of the command, eg: “do something with stuff”

HELP = "If you want to receive notifications in the WhatsApp official client,you need to set your...[source]

Long description of what the command does

NODE = 'wa_presence'[source]

Name of the node used for ad-hoc commands

CHAT_COMMAND = 'presence'[source]

Text to send to the gateway to trigger the command via a message

ACCESS[source]

Who can use this command

async run(session, ifrom, *args)[source]

Entry point of the command

Parameters:
  • session (Optional[slidge_whatsapp.session.Session]) – If triggered by a registered user, its slidge Session

  • ifrom (slixmpp.JID) – JID of the command-triggering entity

  • args – When triggered via chatbot type message, additional words after the CHAT_COMMAND string was passed

Returns:

Either a TableResult, a Form, a Confirmation, a text, or None

Return type:

slidge.command.Form

static finish(form_values, session, _ifrom)[source]
Async:

Parameters:
class slidge_whatsapp.command.SubscribeToPresences(xmpp)[source]

Bases: slidge.command.Command

Abstract base class to implement gateway commands (chatbot and ad-hoc)

Parameters:

xmpp (slidge.core.gateway.BaseGateway)

NAME = "🔔 Subscribe to contacts' presences"[source]

Friendly name of the command, eg: “do something with stuff”

HELP = "Subscribes to and refreshes contacts' presences; typically this is done automatically, but...[source]

Long description of what the command does

NODE = 'wa_subscribe'[source]

Name of the node used for ad-hoc commands

CHAT_COMMAND = 'subscribe'[source]

Text to send to the gateway to trigger the command via a message

ACCESS[source]

Who can use this command

async run(session, ifrom, *args)[source]

Entry point of the command

Parameters:
  • session (Optional[slidge_whatsapp.session.Session]) – If triggered by a registered user, its slidge Session

  • ifrom (slixmpp.JID) – JID of the command-triggering entity

  • args – When triggered via chatbot type message, additional words after the CHAT_COMMAND string was passed

Returns:

Either a TableResult, a Form, a Confirmation, a text, or None

Return type:

str