Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import * as Telebot from 'telebot'
- import * as env from '../environment/environment-handler'
- class BotService {
- private static instance = new BotService();
- private bot;
- constructor() {
- if (!!BotService.instance) return BotService.instance;
- // @ts-ignore
- this.bot = new Telebot(env.telegram.token);
- this.bot.on('text', this.textMessageHandler.bind(this));
- }
- private textMessageHandler(msg): void {
- this.sendMessage(msg.chat.id, 'Submission complete');
- }
- private sendMessage(chatId: string, msg: string): void {
- this.bot.sendMessage(chatId, msg);
- }
- }
- export default new BotService;
Add Comment
Please, Sign In to add comment