1
1
mirror of https://gitlab.com/ceda_ei/Quadnite-Bot synced 2026-05-06 05:40:04 +02:00

Add /absurdify

This commit is contained in:
2019-02-12 04:45:02 +05:30
parent 3b945e17f3
commit 54f1e9a73b
3 changed files with 31 additions and 1 deletions

27
commands/absurdify.js Normal file
View File

@@ -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";
}
};