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)
// dice.block.js
const { Block } = require('degreet-telegram')
const block = new Block()
block.command('start', async (ctx) => {
try {
await ctx.answer.send('Hello, world!')
} catch (e) {
console.error(e)
}
})
module.exports = block
// index.js
bot.use(block)
Last updated