Blocks of code

// dice.block.ts
import { Block } from 'degreet-telegram'
import { IContext } from 'degreet-telegram/src/types'

const block: Block = new Block()

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

export default block

// index.ts
bot.use(block)

Last updated