Sender binds to the current runtime context. For message triggers, it represents the current IM, account, chat, and user. For route triggers, it represents the current HTTP request. Cron / fake contexts may not point to a real IM chat.
Read message context
These methods take no arguments and return fields from the current runtime context. Missing fields usually return an empty string, empty array, orFalse.
| Method | Purpose | Parameters | Returns |
|---|---|---|---|
getImtype() | Get the current IM type. Cron runs may return fake. | None | str |
getUserID() | Get the current user ID. | None | str |
getUserName() | Get the current user display name. | None | str |
getUserAvatarUrl() | Get the current user avatar URL. | None | str |
getChatID() | Get the current chat ID; group chats use group ID, private chats are often empty. | None | str |
getChatName() | Get the current chat name. | None | str |
getGroupName() | Get the group name. Same as getChatName(). | None | str |
isAdmin() | Check whether the current user is an administrator. | None | bool |
isAI() | Check whether the message came from an AI trigger context. | None | bool |
getAIParam() | Get the AI parameter. | None | str |
getMessage() | Get the current message text. | None | str |
getMessageID() | Get the current message ID. | None | str |
getHistoryMessageIDs(number) | Get recent message IDs. | number: required count. | list[str] |
param(index) | Read a rule regex capture. | index starts at 1; out-of-range returns an empty string. | str |
Reply with text and media
reply* methods reply to the current runtime context. For message triggers, they reply to the current chat. For route triggers, reply(...) / replyMarkdown(...) can write the route response. A cron fake context does not send a real IM reply.
| Method | Purpose | Parameters | Returns |
|---|---|---|---|
reply(text) | Reply with plain text. | text: required. | SendReceipt |
replyMarkdown(markdown) | Reply with Markdown text. Rendering depends on the adapter. | markdown: required. | SendReceipt |
replyImage(source, options=None) | Reply with an image. | Image URL, path, base64, or data URI; options optional. | SendReceipt |
replyVoice(source, options=None) | Reply with voice/audio. | Voice URL or path; options optional. | SendReceipt |
replyVideo(source, options=None) | Reply with a video. | Video URL or path; options optional. | SendReceipt |
replyFile(source, options=None) | Reply with a file. | File URL or path; options optional. | SendReceipt |
replyMixed(items, options=None) | Reply with structured mixed messages. | items: required mixed items. | SendReceipt |
returnValue(text) | Set the runtime return value without sending an IM message. | text: required. | Runtime result |
replyImage(...) and other current-chat reply methods do not need imType, group ID, or user ID. Use push(...) or push* when you need to choose the target.MediaOptions
Media reply methods accept an optional dictionary as the second parameter.Display filename. Also accepted as
fileName or file_name.MIME type. Also accepted as
mime_type.Media request timeout. Millisecond values are converted to request timeout.
Control flow
| Method | Purpose | Parameters | Returns |
|---|---|---|---|
setContinue() | Continue matching subsequent plugins. | None | bool |
recallMessage(messageid) | Recall a message. | messageid: message ID. | SendReceipt |
breakIn(content) | Re-enter the message pipeline with new text. | content: required. | Runtime result |
Next steps
- Wait for user input:
Wait for input and payment - Download media and read event fields:
Events, media, and files