RegExp in events

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

bot.on(
  /action_(.*)/,
  async (ctx: IContext): Promise<void> => {
    try {
      const action: string = ctx.matchParams[1]
      await ctx.answer.send(action)
    } catch (e: any) {
      console.error(e)
    }
  }
)

Last updated