-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
54 lines (32 loc) · 1.14 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const Telegraf = require('telegraf');
const TelegrafFlow = require('telegraf-flow');
require("custom-env").env("secrets");
const flow = new TelegrafFlow();
const { Scenes } = require("./src/Scenes");
const { CommandHandler } = require("./src/CommandHandler");
const { Hear } = require("./src/Hear");
// bot
const bot = new Telegraf(process.env.BOT_TOKEN);
// commandHandler
const commandHandler = new CommandHandler(flow);
// Hear
const hear = new Hear(flow);
console.log("==> Bot Started...");
// commands
commandHandler.start();
// Hear
hear.hear();
// register
flow.register(new Scenes().greeterScene());
flow.register(new Scenes().updateScene());
flow.register(new Scenes().registerScene());
flow.register(new Scenes().getGeoCode());
flow.register(new Scenes().locByName());
flow.register(new Scenes().typePlaceScene());
flow.register(new Scenes().totalCapacityScene());
flow.register(new Scenes().currentOccScene());
bot.use(Telegraf.session())
bot.use(flow.middleware())
// bot.telegram.setWebhook("https://.herokuapp.com/" + process.env.BOT_TOKEN);
// bot.startWebhook('/' + process.env.BOT_TOKEN, null, process.env.PORT)
bot.launch()