2019-02-10 20:27:46 +01:00
|
|
|
const Telegraf = require("telegraf");
|
|
|
|
const { BOT_API_KEY } = process.env;
|
|
|
|
const fs = require("fs").promises;
|
|
|
|
const commands = require("./commands");
|
|
|
|
|
|
|
|
const bot = new Telegraf(BOT_API_KEY);
|
|
|
|
|
|
|
|
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 =>
|
|
|
|
fs.readFile(file + ".txt", "utf-8")
|
|
|
|
.then(list =>
|
|
|
|
list.split("\n")));
|
|
|
|
|
|
|
|
Promise.all(data)
|
|
|
|
.then(data =>
|
|
|
|
commands(bot, data));
|
|
|
|
|
2019-02-11 21:23:32 +01:00
|
|
|
bot.launch();
|