Improving Spongebob

This commit is contained in:
Skylar Grant 2022-12-16 14:56:00 -05:00
parent ff4c3f47cf
commit 1da220c5a8
2 changed files with 13 additions and 11 deletions

View File

@ -7,6 +7,11 @@ module.exports = {
description: 'SpOnGeBoB-iFy AnYtHiNg AuToMaTiCaLly', description: 'SpOnGeBoB-iFy AnYtHiNg AuToMaTiCaLly',
usage: '<text to convert>.spongebob', usage: '<text to convert>.spongebob',
execute(message, commandData) { execute(message, commandData) {
message.reply(fn.spongebob(commandData)); // message.reply(fn.spongebob(commandData)).then(() => {
// message.delete();
// });
message.channel.send(fn.spongebob(commandData)).then(() => {
message.delete();
});
} }
} }

View File

@ -506,31 +506,28 @@ const functions = {
} }
}, },
spongebob(commandData) { spongebob(commandData) {
let flipper = 0;
let newText = ''; let newText = '';
for (const letter of commandData.args) { for (const letter of commandData.args) {
if (letter == ' ') { if (letter == ' ') {
newText = newText + letter; newText += letter;
continue; continue;
} }
if (letter == 'i' || letter == 'I') { if (letter == 'i' || letter == 'I') {
newText = newText + 'i'; newText += 'i';
continue; continue;
} }
if (letter == 'l' || letter == 'L') { if (letter == 'l' || letter == 'L') {
newText = newText + 'L'; newText += 'L';
continue; continue;
} }
if (flipper == 0) { if (Math.random() > 0.5) {
newText = newText + letter.toUpperCase(); newText += letter.toUpperCase();
flipper = 1;
} else { } else {
newText = newText + letter; newText += letter.toLowerCase();
flipper = 0;
} }
} }
return newText; return newText + ' <:spongebob:1053399026709569536>';
}, },
}; };