-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
59 lines (45 loc) · 1.69 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
49
50
51
52
53
54
55
56
57
58
59
'use strict';
require('dotenv').config();
const { Telegraf, Markup } = require('telegraf');
const FUNCTIONS = require('./functions');
const bot = new Telegraf(process.env.BOT_TOKEN);//BOT_TOKEN in .env file
//DEFAULT
bot.start((ctx) => {
ctx.reply('🖐Welcome to HLTV HELP BOT🖐',
Markup.keyboard([
['Matches', 'Events'],
['Players', 'Teams']
]).resize());
});
bot.help((ctx) => ctx.reply('🖐Use buttons at bottom 👇 of screen to find info about: [Matches], [Events], [Players] or [Teams]👀'));
//HEARS + COMMANDS
bot.hears('Matches', FUNCTIONS.matchfunc);
bot.hears('Events', FUNCTIONS.eventsfunc);
bot.hears('Players', FUNCTIONS.playersfunc);
bot.hears('Teams', FUNCTIONS.teamsfunc);
bot.command('subscribe', (ctx) => {
if (ctx.message.text.length > 10) FUNCTIONS.commandForSubscribe(bot, ctx, ctx.message.text);
else ctx.reply('Please input [/subscribe <TEAM>] || For example: [/subscribe Astralis]');
});
bot.command('unsubscribe', (ctx) => {
FUNCTIONS.commandForDelSubscribe(ctx);
});
bot.command('news', (ctx) => {
FUNCTIONS.queryForNews(ctx);
});
bot.command('git', (ctx) => {
FUNCTIONS.queryForGit(ctx);
});
bot.command('stream', async (ctx) => {
await ctx.replyWithSticker(FUNCTIONS.GetStickerUrl());
if (ctx.message.text.length > 12) FUNCTIONS.queryForStream(ctx, ctx.message.text);
else ctx.reply('Please input [/stream <MATCH_ID>] || For example: [/stream 2346068]');
});
bot.on('callback_query', ctx => {
FUNCTIONS.onCallbackQuery(ctx);
});
bot.on('text', (ctx) => {
if (ctx.message.text[0] == 'p' && ctx.message.text[1] == '/') FUNCTIONS.queryInlineForPlayer(ctx);
})
FUNCTIONS.LoadBot(bot);
bot.launch();