Handling text messages
You can handle when the user writes a text messages (e.g. 'Hello world!')
import { IContext } from 'degreet-telegram/src/types'
bot.on('text', async (ctx: IContext): Promise<void> => {
try {
await ctx.answer.send(ctx.msg?.text)
} catch (e: any) {
console.error(e)
}
})
bot.on('text', async (ctx) => {
try {
await ctx.answer.send(ctx.msg?.text)
} catch (e) {
console.error(e)
}
})