Add commands/index.js. Add /insults, /kys, answer commands.
Add shrinkwrap.yaml.
This commit is contained in:
27
commands/index.js
Normal file
27
commands/index.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const random = require("./random");
|
||||
const insults_fun = require("./insult");
|
||||
const is = require("./is");
|
||||
module.exports = (bot, [ questions, kys, insults, commands_list ]) => {
|
||||
|
||||
bot.command("question", (ctx) => ctx.reply(random(questions)()));
|
||||
|
||||
const default_text = (command, text) => `Do you want to ${text} yourself?\n`
|
||||
+ `If no, reply to someone with /${command} to kill them or run /${command} username/name.\n`
|
||||
+ `You can suggest more /${command} replies using /feedback`;
|
||||
bot.command("insult", (ctx) => ctx.reply(insults_fun(random, insults, default_text("insult", "insult"))(ctx)));
|
||||
bot.command("kys", (ctx) => ctx.reply(insults_fun(random, kys, default_text("kys", "kill"))(ctx)));
|
||||
|
||||
bot.command("commands", (ctx) => ctx.reply(commands_list.join("\n")));
|
||||
bot.command("is", (ctx) => ctx.reply(is(random)));
|
||||
bot.command("are", (ctx) => ctx.reply(is(random)));
|
||||
bot.command("can", (ctx) => ctx.reply(is(random)));
|
||||
bot.command("will", (ctx) => ctx.reply(is(random)));
|
||||
bot.command("shall", (ctx) => ctx.reply(is(random)));
|
||||
bot.command("was", (ctx) => ctx.reply(is(random)));
|
||||
bot.command("do", (ctx) => ctx.reply(is(random)));
|
||||
bot.command("does", (ctx) => ctx.reply(is(random)));
|
||||
bot.command("did", (ctx) => ctx.reply(is(random)));
|
||||
bot.command("should", (ctx) => ctx.reply(is(random)));
|
||||
bot.command("coin", (ctx) => ctx.reply(random(["Heads", "Tails"])()));
|
||||
|
||||
};
|
||||
22
commands/insult.js
Normal file
22
commands/insult.js
Normal file
@@ -0,0 +1,22 @@
|
||||
module.exports = (random, kys, default_text) => (ctx) => {
|
||||
|
||||
if (ctx.message.reply_to_message) {
|
||||
|
||||
const { from } = ctx.message.reply_to_message;
|
||||
const name = from.username ? "@" + from.username : from.firstName;
|
||||
return random(kys)().replace(/##name##/g, name);
|
||||
|
||||
} else {
|
||||
|
||||
const text_array = ctx.message.text.split(" ");
|
||||
if (text_array.length > 1) {
|
||||
|
||||
const name = text_array[1];
|
||||
return random(kys)().replace(/##name##/g, name);
|
||||
|
||||
} else
|
||||
return default_text;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
7
commands/is.js
Normal file
7
commands/is.js
Normal file
@@ -0,0 +1,7 @@
|
||||
module.exports = (random) =>
|
||||
random([["Yes", "Yep", "Yeah", "Yus", "Ja", "Ya", "Aye", "Ay", "Oui"],
|
||||
["No", "Nopes", "Nu", "Nah", "Nein", "Naw", "Nay", "Yesn't"]][Math.round(
|
||||
Math.random())])();
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
module.exports = (list = []) => (n = 1) =>
|
||||
Array(n).fill(0).map(list[Math.floor(Math.random() * list.length)]);
|
||||
Array(n)
|
||||
.fill(0)
|
||||
.map(() => list[Math.floor(Math.random() * list.length)])
|
||||
.join("\n");
|
||||
|
||||
Reference in New Issue
Block a user