-
Notifications
You must be signed in to change notification settings - Fork 0
/
bot.js
26 lines (22 loc) · 653 Bytes
/
bot.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
const { Telegraf } = require("telegraf");
const { BOT_API_KEY, FEEDBACK_ID, UGOKI_ROOT } = process.env;
const fs = require("fs").promises;
const commands = require("./commands");
const axios = require("axios");
const roleplay = require("./static/roleplay.json");
const bot = new Telegraf(BOT_API_KEY);
bot.catch((err) => console.log(err));
const data = [
"questions",
"kys",
"insults",
"commands_list",
"words"
].map(file =>
fs.readFile("static/" + file + ".txt", "utf-8")
.then(list =>
list.split("\n")));
Promise.all(data)
.then(data =>
commands(bot, [...data, roleplay], FEEDBACK_ID, BOT_API_KEY, UGOKI_ROOT, axios));
bot.launch();