1.0.2 • Published 5 years ago
telegraf-decorators v1.0.2
Example usage
$ npm i telegraf-decorators
import { ContextMessageUpdate } from "telegraf";
import { Start, Sticker, Hears, Bot } from "telegraf-decorators";
import { BotAbstract } from "telegraf-decorators";
@Bot("<your bot's API token>")
export class SerabassBot extends BotAbstract {
public static instance: SerabassBot;
@Start()
@Hears(/hi/i)
protected replyHi(ctx: ContextMessageUpdate) {
return ctx.reply("Hello");
}
@Sticker()
@Hears(/.+?/)
protected reply(ctx: ContextMessageUpdate) {
return ctx.reply("I didn't understand you :(");
}
}