slidge.command.admin

Module Contents

Classes

AdminCommand

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

ListUsers

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

SlidgeInfo

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

DeleteUser

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

ChangeLoglevel

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

Exec

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

class slidge.command.admin.AdminCommand(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, *args)

Entry point of the command

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

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

  • args (str) – 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:

CommandResponseType

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.admin.ListUsers(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 – 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.admin.SlidgeInfo(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 – 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.admin.DeleteUser(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 – 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.admin.ChangeLoglevel(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 – 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.admin.Exec(xmpp)

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

NAME: str

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

HELP: str

Long description of what the command does

async run(session, ifrom, *args)

Entry point of the command

Parameters:
  • 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

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