slidge.core.command.chat_command
#
Handle slidge commands by exchanging chat messages with the gateway components.
Ad-hoc methods should provide a better UX, but some clients do not support them, so this is mostly a fallback.
Module Contents#
Classes#
Functions#
|
Attributes#
- class slidge.core.command.chat_command.ChatCommandProvider(xmpp)[source]#
- Parameters:
xmpp (slidge.core.gateway.BaseGateway) –
- register(command)[source]#
Register a command to be used via chat messages with the gateway
Plugins should not call this, any class subclassing Command should be automatically added by slidge core.
- Parameters:
command (slidge.core.command.Command) – the new command
- async input(jid, text=None, mtype='chat', timeout=60, **msg_kwargs)[source]#
Request arbitrary user input using a simple chat message, and await the result.
You shouldn’t need to call directly bust instead use
BaseSession.input()
to directly target a user.NB: When using this, the next message that the user sent to the component will not be transmitted to
BaseGateway.on_gateway_message()
, but rather intercepted. Await the coroutine to get its content.- Parameters:
jid (slixmpp.JID) – The JID we want input from
text – A prompt to display for the user
mtype (slixmpp.types.MessageTypes) – Message type
timeout –
- Returns:
The user’s reply
- Return type:
- async _handle_result(result, msg, session)[source]#
- Parameters:
result (slidge.core.command.CommandResponseType) –
msg (slixmpp.Message) –