Chat Actions
Main Walkthrough 17 of 22
Clients can show actions such as typing or uploading while preparing a response.
Showing an Action
Use sendChatAction before starting the work.
client.command("status", async (ctx) => {
await ctx.sendChatAction({ type: "typing" });
const status = await getStatus();
await ctx.reply(status);
});
Chat actions remain visible for a short time. Send the action again if the work takes longer.
Reporting Upload Progress
Upload actions can include a progress percentage.
await client.sendChatAction(chatId, {
type: "uploadingDocument",
progress: 50,
});
See ChatActionType for all available actions.
Cancelling an Action
Send the cancel action when no response will follow.
await client.sendChatAction(chatId, { type: "cancel" });