-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
48 lines (43 loc) · 1.44 KB
/
index.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
import { Telegraf } from 'telegraf';
import Settings from './src/settings.js';
import {
drivers,
teams,
tracks,
standings,
calendar,
current,
next,
lastQualy,
lastRace,
} from './src/commands.js';
const bot = new Telegraf(Settings.token);
bot.start((ctx) => ctx.reply('Welcome, type /help to see available commands'))
bot.command('help', function (ctx) {
ctx.replyWithHTML(
[
'/drivers\n Show this year drivers details',
'/teams\n Show this year teams details',
'/tracks\n Show this year tracks details',
'/standings\n Show current standings for both championships',
'/calendar\n Show this year race calendar',
'/current\n Show the schedule for a race weekend in progress',
'/next\n Show the schedule for next race weekend',
'/lastqualy\n Show the results of last weekend qualifying',
'/lastrace\n Show the results of last weekend race',
].join('\n')
);
});
bot.command('drivers', drivers);
bot.command('teams', teams);
bot.command('tracks', tracks);
bot.command('standings', standings);
bot.command('calendar', calendar);
bot.command('current', current);
bot.command('next', next);
bot.command('lastqualy', lastQualy);
bot.command('lastrace', lastRace);
bot.launch();
// Enable graceful stop
process.once('SIGINT', () => bot.stop('SIGINT'));
process.once('SIGTERM', () => bot.stop('SIGTERM'));