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:
27
commands/absurdify.js
Normal file
27
commands/absurdify.js
Normal 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";
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user