Add /absurdify
This commit is contained in:
parent
3b945e17f3
commit
54f1e9a73b
|
@ -0,0 +1,27 @@
|
|||
function absurdify(text) {
|
||||
|
||||
const text_array = text.split("");
|
||||
return text_array.map((character) =>
|
||||
Math.random() > 0.5 ? character.toLowerCase(): character.toUpperCase())
|
||||
.join("");
|
||||
|
||||
}
|
||||
|
||||
module.exports = () => (ctx) => {
|
||||
|
||||
const message = ctx.message.text.replace(/^[^ ]+/, "");
|
||||
if (message) {
|
||||
|
||||
return absurdify(message);
|
||||
|
||||
} else {
|
||||
|
||||
if (ctx.message.reply_to_message)
|
||||
return absurdify(ctx.message.reply_to_message.text);
|
||||
else
|
||||
return "Need text to absurdify. Send /absurdify text or reply to a"
|
||||
+ "message with /absurdify";
|
||||
|
||||
}
|
||||
|
||||
};
|
|
@ -3,6 +3,7 @@ const insults_fun = require("./insult");
|
|||
const words_fun = require("./words");
|
||||
const is = require("./is");
|
||||
const weebify = require("./weebify");
|
||||
const absurdify = require("./absurdify");
|
||||
module.exports = (bot, [ questions, kys, insults, commands_list, words ]) => {
|
||||
|
||||
bot.command("question", (ctx) => ctx.reply(random(questions)()));
|
||||
|
@ -45,5 +46,6 @@ module.exports = (bot, [ questions, kys, insults, commands_list, words ]) => {
|
|||
+ "Directory!](https://t.me/tgdrbot?start=quadnite_bot)", {parse_mode:
|
||||
"Markdown"}));
|
||||
bot.command("weebify", (ctx) => ctx.reply(weebify()(ctx)));
|
||||
bot.command("absurdify", (ctx) => ctx.reply(absurdify()(ctx)));
|
||||
|
||||
};
|
||||
|
|
|
@ -47,7 +47,8 @@ module.exports = () => (ctx) => {
|
|||
if (ctx.message.reply_to_message)
|
||||
return weebify(ctx.message.reply_to_message.text);
|
||||
else
|
||||
return "Need text to weebify. Send /weebify text or reply to a message with /weebify";
|
||||
return "Need text to weebify. Send /weebify text or reply to a "
|
||||
+ "message with /weebify";
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue