1
1
mirror of https://gitlab.com/ceda_ei/Quadnite-Bot synced 2025-07-09 10:26:52 +02:00
Quadnite-Bot/commands/absurdify.js
2019-02-12 04:45:02 +05:30

28 lines
553 B
JavaScript

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