Octanite-Bot/commands/index.js

84 lines
3.7 KiB
JavaScript
Raw Normal View History

const random = require("./random");
const insults_fun = require("./insult");
2019-02-11 23:02:53 +01:00
const words_fun = require("./words");
const is = require("./is");
2019-02-12 00:07:50 +01:00
const weebify = require("./weebify");
2019-02-12 00:15:02 +01:00
const absurdify = require("./absurdify");
2019-02-12 08:40:01 +01:00
const feedback = require("./feedback");
2019-02-12 14:32:38 +01:00
const media_wiki = require("./media_wiki");
2019-02-12 19:28:22 +01:00
const info = require("./info");
2020-04-22 18:26:31 +02:00
const expand = require("./expand");
2021-06-21 19:15:23 +02:00
const roleplay = require("./roleplay");
const suggest = require("./suggest");
2019-02-12 08:40:01 +01:00
module.exports = (bot, [ questions, kys, insults, commands_list, words, roleplay_data ], feedback_id, apiToken, ugokiRoot, axios) => {
bot.command("question", (ctx) => ctx.reply(random(questions)()));
2019-02-11 23:02:53 +01:00
bot.command("word", (ctx) => ctx.reply(random(words)()));
bot.command("words", (ctx) => ctx.reply(words_fun(random, words)(ctx)));
2019-02-11 22:39:42 +01:00
bot.telegram.getMe()
.then(bot_user => {
2019-02-11 22:39:42 +01:00
const default_text = (command, text) => `Do you want to ${text} `
+ `yourself?\nIf no, reply to someone with /${command} to kill`
+ ` them or run /${command} username/name.\nYou can suggest `
+ `more /${command} replies using /feedback`;
bot.command("insult", (ctx) => ctx.reply(insults_fun(random,
insults, default_text("insult", "insult"), "Watch who you talk"
+ " to.", ["@" + bot_user.username, bot_user.firstName])(ctx)));
bot.command("kys", (ctx) => ctx.reply(insults_fun(random, kys,
default_text("kys", "kill"), "I can't be killed.",
["@" + bot_user.username, bot_user.firstName])(ctx)));
});
bot.command("commands", (ctx) => ctx.reply(commands_list.join("\n"), {parse_mode: "html"}));
2019-02-11 21:33:56 +01:00
bot.command("is", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("are", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("can", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("will", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("shall", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("was", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("do", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("does", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("did", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("should", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("coin", (ctx) => ctx.reply(random(["Heads", "Tails"])()));
2019-02-11 23:20:29 +01:00
bot.command("help", (ctx) => ctx.reply("You can either check /commands "
+ "for a short overview or check the [Help Page]"
+ "(https://t.me/quadnite/9).", {parse_mode: "Markdown"}));
bot.command("rate", (ctx) => ctx.reply("[Vote for me on Telegram "
+ "Directory!](https://t.me/tgdrbot?start=quadnite_bot)", {parse_mode:
"Markdown"}));
2019-02-12 00:07:50 +01:00
bot.command("weebify", (ctx) => ctx.reply(weebify()(ctx)));
2019-02-12 00:15:02 +01:00
bot.command("absurdify", (ctx) => ctx.reply(absurdify()(ctx)));
2019-02-12 08:40:01 +01:00
bot.command("feedback", (ctx) => ctx.reply(feedback(feedback_id)(ctx)));
2019-02-12 14:32:38 +01:00
bot.command("wiki", (ctx) => media_wiki(axios,
"https://en.wikipedia.org/w/api.php")(ctx).then(x => ctx.reply(x,
{parse_mode: "HTML"})));
bot.command("arch_wiki", (ctx) => media_wiki(axios,
"https://wiki.archlinux.org/api.php")(ctx).then(x => ctx.reply(x,
{parse_mode: "HTML"})));
2019-02-12 19:28:22 +01:00
bot.command("info", (ctx) => ctx.reply(info()(ctx), {parse_mode: "Markdown"}));
2020-04-22 18:26:31 +02:00
bot.command("expand", (ctx) => ctx.reply(expand(words)(ctx)));
2019-02-14 14:30:19 +01:00
bot.command("start", (ctx) => ctx.reply("Hi, I am Quadnite. If you are "
+ "chatting with me in private, you are most likely doing it wrong. "
+ "Add me to a group for fun. To give feedback, use /feedback"));
const getGetGif = (command) => () => axios.get(
`category/${command}/gif`,
{
baseURL: ugokiRoot
}
);
2021-06-21 19:15:23 +02:00
// Add all roleplay commands
Object.keys(roleplay_data).map(command =>
bot.command(command, ctx => roleplay(roleplay_data[command].forms, getGetGif(command))(ctx)));
2021-06-21 19:15:23 +02:00
bot.command("suggest", (ctx) => suggest(axios, apiToken, ugokiRoot)(ctx));
};