Context
MessageT
module-attribute
¶
MessageT = TypeVar('MessageT', bound='ReceivedMessage')
Type variable for the kind of message a Context was created from, e.g.
Context[DataMessage] in a handler that only fires for data messages.
Context ¶
Context is a helper class that provides methods to reply, edit, react, etc. to a message. This is useful to avoid having to pass the recipient and other arguments to the bot's methods manually.
Method names mirror the underlying bot.<noun> action they call (e.g. react
calls bot.reactions.react). The exception is when that name would be
ambiguous as a bare call on Context, which bundles several actions into one
flat namespace unlike bot.<noun> (e.g. update_contact/update_group both
call an underlying .update(), so the noun is kept here to disambiguate).
Source code in src/signalbot/context/context.py
create_poll
async
¶
create_poll(create_poll_request: CreatePoll) -> CreatedPoll
Same as signalbot.PollActions.create() but with the recipient set to the message's recipient.
Source code in src/signalbot/context/context.py
send
async
¶
send(message: SendMessage) -> SentMessage
Same as signalbot.MessageActions.send() but with the recipient set to the message's recipient.
Source code in src/signalbot/context/context.py
start_typing
async
¶
Same as signalbot.MessageActions.start_typing() but with the recipient set to the message's recipient.
Source code in src/signalbot/context/context.py
stop_typing
async
¶
Same as signalbot.MessageActions.stop_typing() but with the recipient set to the message's recipient.
Source code in src/signalbot/context/context.py
update_contact
async
¶
update_contact(update_contact: UpdateContact) -> None
Same as signalbot.ContactActions.update() but with the recipient set to the message's recipient.
Source code in src/signalbot/context/context.py
update_group
async
¶
update_group(update_group: UpdateGroup) -> None
Same as signalbot.GroupActions.update() but with the group id or name set to the message's recipient.
Source code in src/signalbot/context/context.py
DataMessageContext ¶
Bases: Context[DataMessage | EditMessage]
Source code in src/signalbot/context/context.py
delete_attachment
async
¶
delete_attachment(attachment: Attachment) -> None
Same as signalbot.AttachmentActions.delete().
edit
async
¶
edit(
new_message: SendMessage, original_message: SentMessage
) -> SentMessage
Same as signalbot.MessageActions.edit().
Source code in src/signalbot/context/data_message_context.py
react
async
¶
react(emoji: str) -> None
Same as signalbot.ReactionActions.react() but with the recipient set to the message's recipient.
Source code in src/signalbot/context/data_message_context.py
remote_delete
async
¶
remote_delete(sent_message: SentMessage) -> int
Same as signalbot.MessageActions.remote_delete().
Source code in src/signalbot/context/data_message_context.py
reply
async
¶
reply(message: SendMessage) -> SentMessage
Same as signalbot.MessageActions.send() but with the quote arguments set to the message's.
Source code in src/signalbot/context/data_message_context.py
send_receipt
async
¶
send_receipt(receipt_type: ReceiptType) -> None
Same as signalbot.ReceiptActions.send() but with the recipient set to the message's recipient.