Compare commits
No commits in common. "fde5830309bece519776ec89d78932964e021393" and "6da0e12171ae515930ecad94cc399d87a4b30b79" have entirely different histories.
fde5830309
...
6da0e12171
3
bot.js
3
bot.js
|
@ -3,7 +3,6 @@ const { BOT_API_KEY, FEEDBACK_ID } = process.env;
|
||||||
const fs = require("fs").promises;
|
const fs = require("fs").promises;
|
||||||
const commands = require("./commands");
|
const commands = require("./commands");
|
||||||
const axios = require("axios");
|
const axios = require("axios");
|
||||||
const roleplay = require("./roleplay.json");
|
|
||||||
|
|
||||||
const bot = new Telegraf(BOT_API_KEY);
|
const bot = new Telegraf(BOT_API_KEY);
|
||||||
bot.catch((err) => console.log(err));
|
bot.catch((err) => console.log(err));
|
||||||
|
@ -21,6 +20,6 @@ const data = [
|
||||||
|
|
||||||
Promise.all(data)
|
Promise.all(data)
|
||||||
.then(data =>
|
.then(data =>
|
||||||
commands(bot, [...data, roleplay], FEEDBACK_ID, axios));
|
commands(bot, data, FEEDBACK_ID, axios));
|
||||||
|
|
||||||
bot.launch();
|
bot.launch();
|
||||||
|
|
|
@ -8,9 +8,8 @@ const feedback = require("./feedback");
|
||||||
const media_wiki = require("./media_wiki");
|
const media_wiki = require("./media_wiki");
|
||||||
const info = require("./info");
|
const info = require("./info");
|
||||||
const expand = require("./expand");
|
const expand = require("./expand");
|
||||||
const roleplay = require("./roleplay");
|
|
||||||
|
|
||||||
module.exports = (bot, [ questions, kys, insults, commands_list, words, roleplay_data ], feedback_id, axios) => {
|
module.exports = (bot, [ questions, kys, insults, commands_list, words ], feedback_id, axios) => {
|
||||||
|
|
||||||
bot.command("question", (ctx) => ctx.reply(random(questions)()));
|
bot.command("question", (ctx) => ctx.reply(random(questions)()));
|
||||||
bot.command("word", (ctx) => ctx.reply(random(words)()));
|
bot.command("word", (ctx) => ctx.reply(random(words)()));
|
||||||
|
@ -33,7 +32,7 @@ module.exports = (bot, [ questions, kys, insults, commands_list, words, roleplay
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
bot.command("commands", (ctx) => ctx.reply(commands_list.join("\n"), {parse_mode: "html"}));
|
bot.command("commands", (ctx) => ctx.reply(commands_list.join("\n")));
|
||||||
bot.command("is", (ctx) => ctx.reply(is(random)(ctx)));
|
bot.command("is", (ctx) => ctx.reply(is(random)(ctx)));
|
||||||
bot.command("are", (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("can", (ctx) => ctx.reply(is(random)(ctx)));
|
||||||
|
@ -66,8 +65,4 @@ module.exports = (bot, [ questions, kys, insults, commands_list, words, roleplay
|
||||||
+ "chatting with me in private, you are most likely doing it wrong. "
|
+ "chatting with me in private, you are most likely doing it wrong. "
|
||||||
+ "Add me to a group for fun. To give feedback, use /feedback"));
|
+ "Add me to a group for fun. To give feedback, use /feedback"));
|
||||||
|
|
||||||
// Add all roleplay commands
|
|
||||||
Object.keys(roleplay_data).map(command =>
|
|
||||||
bot.command(command, ctx => roleplay(roleplay_data[command].forms, roleplay_data[command].gifs)(ctx)));
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
function joinUsers(users) {
|
|
||||||
|
|
||||||
if (users.length == 1)
|
|
||||||
return users[0];
|
|
||||||
return users.slice(0, users.length - 1).join(", ")
|
|
||||||
+ ` and ${users[users.length - 1]}`;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = (forms, gifs) => (ctx) => {
|
|
||||||
|
|
||||||
const gif = gifs[Math.floor(Math.random() * gifs.length)];
|
|
||||||
const message = ctx.message.text.replace(/^[^ ]+\s*/, "")
|
|
||||||
.match(/^((@\w+(\s+|$))*)(.*)/);
|
|
||||||
const users = message[1].trim().split(" ").filter(i => i.length);
|
|
||||||
const reason = message[4];
|
|
||||||
let reply = "";
|
|
||||||
const from = ctx.message.from;
|
|
||||||
const user = from.username ? "@" + from.username : from.first_name;
|
|
||||||
if (users.length > 0 && reason.length > 0)
|
|
||||||
reply = forms.both
|
|
||||||
.replace("{}", user)
|
|
||||||
.replace("{}", joinUsers(users))
|
|
||||||
.replace("{}", reason);
|
|
||||||
else if (users.length > 0)
|
|
||||||
reply = forms.others
|
|
||||||
.replace("{}", user)
|
|
||||||
.replace("{}", joinUsers(users));
|
|
||||||
else if (reason.length > 0)
|
|
||||||
reply = forms.reason
|
|
||||||
.replace("{}", user)
|
|
||||||
.replace("{}", reason);
|
|
||||||
else
|
|
||||||
reply = forms.none
|
|
||||||
.replace("{}", user);
|
|
||||||
|
|
||||||
ctx.replyWithAnimation(gif, {caption: reply});
|
|
||||||
|
|
||||||
};
|
|
|
@ -1,61 +1,24 @@
|
||||||
<b>Random</b>
|
|
||||||
|
|
||||||
coin - Tosses a coin
|
|
||||||
wiki - Search Wikipedia
|
|
||||||
arch_wiki - Search the Arch wiki
|
|
||||||
kys - Kill yourself
|
|
||||||
insult - As expected, insults
|
|
||||||
|
|
||||||
<b>Wordplay</b>
|
|
||||||
|
|
||||||
question - Get a random question
|
question - Get a random question
|
||||||
word - Get a random word
|
word - Get a random word
|
||||||
words - Get n random words
|
words - Get n random words
|
||||||
|
kys - Kill yourself
|
||||||
|
coin - Tosses a coin
|
||||||
|
wiki - Search Wikipedia
|
||||||
|
arch_wiki - Search the Arch wiki
|
||||||
|
insult - As expected, insults
|
||||||
weebify - Weebifies the given text
|
weebify - Weebifies the given text
|
||||||
absurdify - mAke tExT aBSUrd
|
absurdify - mAke tExT aBSUrd
|
||||||
expand - Expands a given abbreviation
|
is - Is <your question>
|
||||||
|
are - Are <your question>
|
||||||
<b>Ask a question</b>
|
can - Can <your question>
|
||||||
<code>
|
will - will <your question>
|
||||||
is are can
|
shall - shall <your question>
|
||||||
will did shall
|
was - Was <your question>
|
||||||
was do does
|
do - Do <your question>
|
||||||
should
|
does - Does <your question>
|
||||||
</code>
|
did - Did <your question>
|
||||||
<b>Roleplay</b>
|
should - Should <your question>
|
||||||
<code>
|
|
||||||
angry bite
|
|
||||||
blush bored
|
|
||||||
bonk boop
|
|
||||||
chase cheer
|
|
||||||
cringe cry
|
|
||||||
cuddle dab
|
|
||||||
dance die
|
|
||||||
eat facepalm
|
|
||||||
feed glomp
|
|
||||||
happy hate
|
|
||||||
holdhands hide
|
|
||||||
highfive hug
|
|
||||||
kill kiss
|
|
||||||
laugh lick
|
|
||||||
love lurk
|
|
||||||
nervous no
|
|
||||||
nom nuzzle
|
|
||||||
panic pat
|
|
||||||
peck poke
|
|
||||||
pout run
|
|
||||||
shoot shrug
|
|
||||||
sip slap
|
|
||||||
sleep snuggle
|
|
||||||
stab tease
|
|
||||||
think thumbsup
|
|
||||||
tickle triggered
|
|
||||||
twerk wag
|
|
||||||
wave wink
|
|
||||||
yes
|
|
||||||
</code>
|
|
||||||
<b>Miscallenous</b>
|
|
||||||
|
|
||||||
help - Need help? Go here
|
help - Need help? Go here
|
||||||
feedback - Send feedback, suggestion for kys, insult text
|
feedback - Send feedback, suggestion for kys, insult text
|
||||||
rate - Rate me on TGDR
|
rate - Rate me on TGDR
|
||||||
|
expand - Expands a given abbreviation
|
||||||
|
|
1150
roleplay.json
1150
roleplay.json
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue