Octanite-Bot/bot.js

26 lines
533 B
JavaScript
Raw Normal View History

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