2021-06-12 12:53:51 +02:00
|
|
|
module.exports = {
|
|
|
|
name: "code",
|
|
|
|
Owner: true,
|
|
|
|
run: async (client, message, args) => {
|
|
|
|
const encrypted = encrypt(args.slice(0).join(" "));
|
|
|
|
message.channel.send(`\`\`\`${encrypted}\`\`\``);
|
2021-11-18 18:56:42 +01:00
|
|
|
message.channel.send(`\`\`\`${decrypt(encrypted)}\`\`\``);
|
|
|
|
const str;
|
2021-06-12 12:53:51 +02:00
|
|
|
function encrypt(inp) {
|
2021-11-18 18:56:42 +01:00
|
|
|
let str = inp.split(""),
|
2021-06-12 12:53:51 +02:00
|
|
|
out = "";
|
|
|
|
str.forEach((c, i) => {
|
|
|
|
if (c == " ") {
|
|
|
|
out += " ";
|
|
|
|
} else if (i % 3 == 0) {
|
|
|
|
out += String.fromCharCode(c.charCodeAt(0) + 3);
|
|
|
|
} else {
|
|
|
|
out += String.fromCharCode(c.charCodeAt(0) - 2);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
|
|
|
function decrypt(inp) {
|
2021-11-18 18:56:42 +01:00
|
|
|
let str = inp.split(""),
|
2021-06-12 12:53:51 +02:00
|
|
|
out = "";
|
|
|
|
str.forEach((c, i) => {
|
|
|
|
if (c == " ") {
|
|
|
|
out += " ";
|
|
|
|
} else if (i % 3 == 0) {
|
|
|
|
out += String.fromCharCode(c.charCodeAt(0) - 3);
|
|
|
|
} else {
|
|
|
|
out += String.fromCharCode(c.charCodeAt(0) + 2);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
};
|