Don't reply if no question exists

This commit is contained in:
Ceda EI 2019-02-12 02:03:56 +05:30
parent 2b6837adb5
commit 71809ed109
2 changed files with 19 additions and 14 deletions

View File

@ -12,16 +12,16 @@ module.exports = (bot, [ questions, kys, insults, commands_list ]) => {
bot.command("kys", (ctx) => ctx.reply(insults_fun(random, kys, default_text("kys", "kill"))(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("commands", (ctx) => ctx.reply(commands_list.join("\n")));
bot.command("is", (ctx) => ctx.reply(is(random))); bot.command("is", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("are", (ctx) => ctx.reply(is(random))); bot.command("are", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("can", (ctx) => ctx.reply(is(random))); bot.command("can", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("will", (ctx) => ctx.reply(is(random))); bot.command("will", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("shall", (ctx) => ctx.reply(is(random))); bot.command("shall", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("was", (ctx) => ctx.reply(is(random))); bot.command("was", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("do", (ctx) => ctx.reply(is(random))); bot.command("do", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("does", (ctx) => ctx.reply(is(random))); bot.command("does", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("did", (ctx) => ctx.reply(is(random))); bot.command("did", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("should", (ctx) => ctx.reply(is(random))); bot.command("should", (ctx) => ctx.reply(is(random)(ctx)));
bot.command("coin", (ctx) => ctx.reply(random(["Heads", "Tails"])())); bot.command("coin", (ctx) => ctx.reply(random(["Heads", "Tails"])()));
}; };

View File

@ -1,7 +1,12 @@
module.exports = (random) => module.exports = (random) => (ctx) =>
random([["Yes", "Yep", "Yeah", "Yus", "Ja", "Ya", "Aye", "Ay", "Oui"], {
const text_array = ctx.message.text.split(" ");
if (text_array.length == 1)
return "You know, you also have to ask the question.";
return random([["Yes", "Yep", "Yeah", "Yus", "Ja", "Ya", "Aye", "Ay", "Oui"],
["No", "Nopes", "Nu", "Nah", "Nein", "Naw", "Nay", "Yesn't"]][Math.round( ["No", "Nopes", "Nu", "Nah", "Nein", "Naw", "Nay", "Yesn't"]][Math.round(
Math.random())])(); Math.random())])();
};