-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
78 lines (57 loc) · 2.05 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const Telegraf = require('telegraf');
const TelegrafFlow = require('telegraf-flow');
const flow = new TelegrafFlow();
const Secrets = require("./src/Secrets");
const { Scenes } = require("./src/Scenes");
const { CommandHandler } = require("./src/CommandHandler");
const { Hear } = require("./src/Hear");
// const { ActionHandler } = require("./src/ActionHandler");
// get & parse .env file
const dotenv = require('dotenv').config();
if (dotenv.error) {
throw dotenv.error
}
// bot
const bot = new Telegraf(process.env.BOT_TOKEN);
// commandHandler
const commandHandler = new CommandHandler(flow);
// Hear
const hear = new Hear(flow);
// Action
// const actionHandler = new ActionHandler(bot);
console.log("==> Bot Started...");
// commands
commandHandler.start(flow);
// Hear
hear.hear();
// action
// actionHandler.actions();
// register
flow.register(new Scenes().collectDataScene());
flow.register(new Scenes().getAreaOfWorksScene());
flow.register(new Scenes().symptomsScene());
flow.register(new Scenes().ppesUsedScene());
flow.register(new Scenes().greeterScene());
flow.register(new Scenes().getHospitalName());
flow.register(new Scenes().reportScene());
flow.register(new Scenes().aboutScene());
flow.register(new Scenes().getNameScene());
flow.register(new Scenes().getPhone());
flow.register(new Scenes().getAge());
flow.register(new Scenes().getGender());
flow.register(new Scenes().getGPSCoord());
flow.register(new Scenes().getLocation());
flow.register(new Scenes().finScene());
flow.register(new Scenes().symptomScene());
flow.register(new Scenes().statScene());
flow.register(new Scenes().getprofessionScene());
flow.register(new Scenes().physiciansGuide());
flow.register(new Scenes().manageAdmins());
flow.register(new Scenes().addNewAdmins());
flow.register(new Scenes().getTelegramHandel());
flow.register(new Scenes().setGuide());
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()