using msg
Using the msg Instance¶
The msg instance is used to interact with the current Telegram message.
It allows replying, sending new messages, editing, deleting, reacting, forwarding, and performing chat actions.
All msg methods return Promises.
Using await is optional and only needed if you want the response object.
Available Methods¶
-
Core Messaging
msg.reply()
msg.send() -
Media Messages
msg.replyPhoto()
msg.replyVideo()
msg.replyDocument() -
Message Management
msg.editText()
msg.delete()
msg.react()
msg.pin()
msg.unpin() -
Forwarding & Copying
msg.forward()
msg.copy() -
Special Messages
msg.replySticker()
msg.replyDice() -
Chat Actions
msg.sendChatAction()
Core Messaging¶
Reply to the current message:
Send a new message:
msg.send("This is a new message")
await msg.send("This is a new message", { parse_mode: "Markdown" })
Media Messages¶
Reply with a photo:
msg.replyPhoto("https://example.com/cat.jpg", { caption: "Cute cat 🐱" })
await msg.replyPhoto("https://example.com/cat.jpg", { caption: "Cute cat 🐱" })
Reply with a video:
msg.replyVideo("https://example.com/video.mp4")
await msg.replyVideo("https://example.com/video.mp4", { caption: "Watch this!" })
Reply with a document:
Message Management¶
Edit message text:
Delete a message:
React to a message:
Pin and unpin messages:
Forwarding & Copying¶
Forward a message:
Copy a message:
msg.copy(123456789, { caption: "Copied message" })
await msg.copy(123456789, { caption: "Copied message" })
Special Messages¶
Reply with a sticker:
Reply with a dice:
Chat Actions¶
Show typing indicator:
Other supported actions include:
upload_photorecord_videorecord_audioupload_document
Chained Methods¶
When you use await, msg methods support chained actions.
More details about chained methods: Api chained