slidge_whatsapp.command#

Module Contents#

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)

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]#
HELP = 'Disconnects active WhatsApp session without removing any linked device credentials. To...'[source]#
NODE = 'wa_logout'[source]#
CHAT_COMMAND = 'logout'[source]#
ACCESS[source]#
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]#
HELP = 'As an alternative to QR code verification, this allows you to complete registration by inputing...'[source]#
NODE = 'wa_pair_phone'[source]#
CHAT_COMMAND = 'pair-phone'[source]#
ACCESS[source]#
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

async static finish(form_values, session, _ifrom)[source]#
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]#
HELP = 'If you want to receive notifications in the WhatsApp official client,you need to set your...'[source]#
NODE = 'wa_presence'[source]#
CHAT_COMMAND = 'presence'[source]#
ACCESS[source]#
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

async static finish(form_values, session, _ifrom)[source]#
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]#
HELP = "Subscribes to and refreshes contacts' presences; typically this is done automatically, but..."[source]#
NODE = 'wa_subscribe'[source]#
CHAT_COMMAND = 'subscribe'[source]#
ACCESS[source]#
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