slidge.command.user#

Module Contents#

Classes#

Search

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

SyncContacts

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

ListContacts

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

ListGroups

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

Login

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

CreateGroup

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

Unregister

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

class slidge.command.user.Search(xmpp)#

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

Parameters:

xmpp (slidge.core.gateway.BaseGateway) –

async run(session, _ifrom, *args)#

Entry point of the command

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

  • ifrom – JID of the command-triggering entity

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

  • _ifrom (slixmpp.JID) –

Returns:

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

Return type:

Union[slidge.command.base.Form, slidge.command.base.SearchResult, None]

raise_if_not_authorized(jid)#

Raise an appropriate error is jid is not authorized to use the command

Parameters:

jid (slixmpp.JID) – jid of the entity trying to access the command

Return type:

Optional[BaseSession[Any, Any]]

:return:session of JID if it exists

class slidge.command.user.SyncContacts(xmpp)#

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

Parameters:

xmpp (slidge.core.gateway.BaseGateway) –

NODE: str#

Name of the node used for ad-hoc commands

CHAT_COMMAND: str#

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

async run(session, _ifrom, *_)#

Entry point of the command

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

  • ifrom – 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.base.Confirmation

raise_if_not_authorized(jid)#

Raise an appropriate error is jid is not authorized to use the command

Parameters:

jid (slixmpp.JID) – jid of the entity trying to access the command

Return type:

Optional[BaseSession[Any, Any]]

:return:session of JID if it exists

class slidge.command.user.ListContacts(xmpp)#

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

Parameters:

xmpp (slidge.core.gateway.BaseGateway) –

NAME: str#

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

HELP: str#

Long description of what the command does

NODE: str#

Name of the node used for ad-hoc commands

CHAT_COMMAND: str#

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

async run(session, _ifrom, *_)#

Entry point of the command

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

  • ifrom – JID of the command-triggering entity

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

  • _ifrom (slixmpp.JID) –

Returns:

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

Return type:

slidge.command.base.TableResult

raise_if_not_authorized(jid)#

Raise an appropriate error is jid is not authorized to use the command

Parameters:

jid (slixmpp.JID) – jid of the entity trying to access the command

Return type:

Optional[BaseSession[Any, Any]]

:return:session of JID if it exists

class slidge.command.user.ListGroups(xmpp)#

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

Parameters:

xmpp (slidge.core.gateway.BaseGateway) –

NAME: str#

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

HELP: str#

Long description of what the command does

NODE: str#

Name of the node used for ad-hoc commands

CHAT_COMMAND: str#

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

async run(session, _ifrom, *_)#

Entry point of the command

Parameters:
  • session – If triggered by a registered user, its slidge Session

  • ifrom – 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

raise_if_not_authorized(jid)#

Raise an appropriate error is jid is not authorized to use the command

Parameters:

jid (slixmpp.JID) – jid of the entity trying to access the command

Return type:

Optional[BaseSession[Any, Any]]

:return:session of JID if it exists

class slidge.command.user.Login(xmpp)#

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

Parameters:

xmpp (slidge.core.gateway.BaseGateway) –

NODE: str#

Name of the node used for ad-hoc commands

CHAT_COMMAND: str#

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

CATEGORY: str | None#

If used, the command will be under this top-level category. Use the same string for several commands to group them. This hierarchy only used for the adhoc interface, not the chat command interface.

async run(session, _ifrom, *_)#

Entry point of the command

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

  • ifrom – 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

raise_if_not_authorized(jid)#

Raise an appropriate error is jid is not authorized to use the command

Parameters:

jid (slixmpp.JID) – jid of the entity trying to access the command

Return type:

Optional[BaseSession[Any, Any]]

:return:session of JID if it exists

class slidge.command.user.CreateGroup(xmpp)#

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

Parameters:

xmpp (slidge.core.gateway.BaseGateway) –

NODE: str#

Name of the node used for ad-hoc commands

CHAT_COMMAND: str#

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

async run(session, _ifrom, *_)#

Entry point of the command

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

  • ifrom – 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

raise_if_not_authorized(jid)#

Raise an appropriate error is jid is not authorized to use the command

Parameters:

jid (slixmpp.JID) – jid of the entity trying to access the command

Return type:

Optional[BaseSession[Any, Any]]

:return:session of JID if it exists

class slidge.command.user.Unregister(xmpp)#

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

Parameters:

xmpp (slidge.core.gateway.BaseGateway) –

NODE: str#

Name of the node used for ad-hoc commands

CHAT_COMMAND: str#

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

CATEGORY: str | None#

If used, the command will be under this top-level category. Use the same string for several commands to group them. This hierarchy only used for the adhoc interface, not the chat command interface.

async run(session, _ifrom, *_)#

Entry point of the command

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

  • ifrom – JID of the command-triggering entity

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

  • _ifrom (slixmpp.JID) –

  • _ (Any) –

Returns:

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

Return type:

slidge.command.base.Confirmation

raise_if_not_authorized(jid)#

Raise an appropriate error is jid is not authorized to use the command

Parameters:

jid (slixmpp.JID) – jid of the entity trying to access the command

Return type:

Optional[BaseSession[Any, Any]]

:return:session of JID if it exists