2024-01-24 20:08:35 +01:00
|
|
|
const { Telegraf } = require("telegraf");
|
2021-09-27 18:06:21 +02:00
|
|
|
const { BOT_API_KEY, FEEDBACK_ID, UGOKI_ROOT } = process.env;
|
2019-02-10 20:27:46 +01:00
|
|
|
const fs = require("fs").promises;
|
|
|
|
const commands = require("./commands");
|
2019-02-12 14:32:38 +01:00
|
|
|
const axios = require("axios");
|
2021-09-27 20:23:33 +02:00
|
|
|
const roleplay = require("./static/roleplay.json");
|
2019-02-10 20:27:46 +01:00
|
|
|
|
|
|
|
const bot = new Telegraf(BOT_API_KEY);
|
2019-03-04 10:18:26 +01:00
|
|
|
bot.catch((err) => console.log(err));
|
2019-02-10 20:27:46 +01:00
|
|
|
|
|
|
|
const data = [
|
|
|
|
"questions",
|
|
|
|
"kys",
|
|
|
|
"insults",
|
2019-02-11 23:02:53 +01:00
|
|
|
"commands_list",
|
|
|
|
"words"
|
2019-02-10 20:27:46 +01:00
|
|
|
].map(file =>
|
2021-09-27 20:23:33 +02:00
|
|
|
fs.readFile("static/" + file + ".txt", "utf-8")
|
2019-02-10 20:27:46 +01:00
|
|
|
.then(list =>
|
|
|
|
list.split("\n")));
|
|
|
|
|
|
|
|
Promise.all(data)
|
|
|
|
.then(data =>
|
2021-09-27 18:06:21 +02:00
|
|
|
commands(bot, [...data, roleplay], FEEDBACK_ID, BOT_API_KEY, UGOKI_ROOT, axios));
|
2019-02-10 20:27:46 +01:00
|
|
|
|
2019-02-11 21:23:32 +01:00
|
|
|
bot.launch();
|