From 532374391dc0a210a4cdcbd25402382cc6c64166 Mon Sep 17 00:00:00 2001 From: Leo Vigna Date: Sun, 24 Nov 2024 14:26:06 +0700 Subject: [PATCH] add on message example telegram bot starter --- packages/starter-telegram-bot/src/bot.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/starter-telegram-bot/src/bot.ts b/packages/starter-telegram-bot/src/bot.ts index b60b0e8..7442bde 100644 --- a/packages/starter-telegram-bot/src/bot.ts +++ b/packages/starter-telegram-bot/src/bot.ts @@ -34,3 +34,9 @@ export const bot = getBot({ initial: () => ({ counter: 0 }), }), }); + +// Catch all when outside of command context +bot.on("message", async (ctx) => { + const message = ctx.message; // the message object + await ctx.reply(`Echo: ${message.text}`); +});