ts-telegraf-decorators
ts-telegraf-decorators
This is a simple library that will allow you to use decorators and typescript. Based on telegraf
Installation
$ npm install ts-telegraf-decorators
Base Examples
Create controller
import {Start, Command, TFController} from 'ts-telegraf-decorators'
@TFController()
export class ControllerTest {
@Start()
start(ctx: any){
ctx.reply('Hello start')
}
@Command('ping')
ping(ctx: any){
ctx.reply('pong')
}
}
Create app.ts
import {buildBot} from "ts-telegraf-decorators";
buildBot({
token: process.env.BOT_TOKEN,
controllers: [__dirname+'/controllers/**.js'],
}).startPolling()