Handling commands

You can handle when the user writes a commands (e.g. /start, /admin, /stats) with method "command" on bot class

import { IContext } from 'degreet-telegram/src/types'

bot.command('start', async (ctx: IContext): Promise<void> => {
  try {
    await ctx.answer.send('Hello!')
  } catch (e: any) {
    console.error(e)
  }
})

Last updated