One handler for different events
import { IContext } from 'degreet-telegram/src/types'
bot.listen(
['Hello, world', 'Hello!'],
async (ctx: IContext): Promise<void> => {
try {
await ctx.answer.send(ctx.msg.text)
} catch (e: any) {
console.error(e)
}
}
)
bot.listen(
['Hello, world', 'Hello!'],
async (ctx) => {
try {
await ctx.answer.send(ctx.msg.text)
} catch (e) {
console.error(e)
}
}
)
You can also use it for bot.on and bot.command