Sender binds to the current runtime context. For a message trigger, it represents the current IM, account, chat, and user. For a route trigger, it represents the current HTTP request. A cron / fake context does not point to a real IM chat.
Read message context
These methods take no parameters and return fields from the current runtime context. When a field does not exist, they usually return an empty string, empty array, orfalse.
Reply with text and media
reply* methods reply to the current runtime context: for a message trigger, they reply to the current chat; for a route trigger, reply(...) / replyMarkdown(...) writes the route response; the fake context for cron does not send a real IM reply.
Current-chat reply methods such as
replyImage(...) do not require you to pass imType, group ID, or user ID. To specify a target, use push(...) or push*.MediaOptions
The second parameter of media reply methods is an optional object.
string
File display name. You can also write
fileName or file_name. The runtime normalizes it to media item name.string
MIME type. You can also write
mime_type, such as image/png, video/mp4, or text/csv.object
Constraints passed to the media preparation flow. Use only when you need to limit output format or size.
object
Extension options passed to the media preparation flow. Regular plugins usually do not need this.
number
Reserved timeout field. Current direct media reply helpers use the built-in media timeout.
replyMixed(items, options?)
items is an array. Text items use text; media items use source, and can also use file, url, or path as source aliases. The runtime discards invalid mixed items.
MediaItem[]
required
Mixed message array. Supports
text, markdown, image, voice, video, and file. The runtime normalizes it before passing it to the adapter.MediaOptions
Optional default media options. When a media item has no
name / mime_type, values can be filled from here.
Example
SendReceipt:
Control flow
Next steps
Wait for input and payment
See
listen(...), input(...), and waitPay(...).User-uploaded files
See
getMediaItems() and downloadAdapterFile(...).