slidgram.command#

Module Contents#

Classes#

SessionCommandMixin

ListSessions

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

TerminateSession

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

JoinPublicChat

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

SearchPublicChats

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

Functions#

class slidgram.command.SessionCommandMixin[source]#
INSTRUCTIONS: str[source]#
CATEGORY: str | None = '🛫 Telegram sessions'[source]#
async run(session, ifrom, *args)[source]#
Parameters:

ifrom (slixmpp.JID) –

abstract async step2(form_values, _session, _ifrom, tg_sessions)[source]#
Parameters:

tg_sessions (list[aiotdlib.api.Session]) –

class slidgram.command.ListSessions(xmpp)[source]#

Bases: SessionCommandMixin, slidge.command.Command

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

Parameters:

xmpp (slidge.core.gateway.BaseGateway) –

NAME = '📋 List telegram sessions'[source]#
ACCESS[source]#
INSTRUCTIONS = 'Pick a session for more details'[source]#
async step2(form_values, _session, _ifrom, tg_sessions)[source]#
Parameters:

tg_sessions (list[aiotdlib.api.Session]) –

class slidgram.command.TerminateSession(xmpp)[source]#

Bases: SessionCommandMixin, slidge.command.Command

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

Parameters:

xmpp (slidge.core.gateway.BaseGateway) –

NAME = '❌ Terminate a telegram session'[source]#
ACCESS[source]#
INSTRUCTIONS = 'Pick a session to terminate it'[source]#
async step2(form_values, session, _ifrom, tg_sessions)[source]#
Parameters:

tg_sessions (list[aiotdlib.api.Session]) –

async static finish(session, _ifrom, session_i)[source]#
Parameters:
class slidgram.command.JoinPublicChat(xmpp)[source]#

Bases: slidge.command.Command

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

Parameters:

xmpp (slidge.core.gateway.BaseGateway) –

NAME = '🚪 Join a telegram public chat'[source]#
HELP = 'Join a public channel, private group or supergroup'[source]#
ACCESS[source]#
INSTRUCTIONS = 'Use a tg:// URI or a or a https://tg.me URL to join a group'[source]#
CATEGORY[source]#
async run(_session, _ifrom, *_args)[source]#

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

async static finish(form_values, session, _ifrom)[source]#
Parameters:
class slidgram.command.SearchPublicChats(xmpp)[source]#

Bases: slidge.command.Command

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

Parameters:

xmpp (slidge.core.gateway.BaseGateway) –

NAME = '🔎 Search telegram public chats'[source]#
HELP = 'Searches public chats by looking for specified query in their username and title. Currently,...'[source]#
ACCESS[source]#
INSTRUCTIONS = 'Enter search terms'[source]#
CATEGORY[source]#
async run(_session, _ifrom, *_args)[source]#

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

async step2(form_values, session, _ifrom)[source]#
Parameters:
async static join(form_values, session, _ifrom)[source]#
Parameters:
slidgram.command.fmt_timestamp(t)[source]#
Parameters:

t (int) –