-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
29 lines (24 loc) · 984 Bytes
/
Copy pathapp.js
File metadata and controls
29 lines (24 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require("dotenv").config();
const CryptoJS = require("crypto-js");
const Discord = require('discord.js');
const client = new Discord.Client();
const prefix = "!";
// console.log(process.env.Token);
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
client.on('message', msg => {
if (msg.content.startsWith(prefix)) {
const args = msg.content.slice(prefix.length).split(" ");
const command = args.shift().toLowerCase();
if (command === 'aesenc') {
const encrypted = CryptoJS.AES.encrypt(args.toString(),process.env.key);
msg.reply(`\n origin : ${args} \n encrypted : ${encrypted}`);
} else if(command === 'aesdec'){
const bytes = CryptoJS.AES.decrypt(args.toString(),process.env.key);
const decrypted = bytes.toString(CryptoJS.enc.Utf8);
msg.reply(`\n origin : ${args} \n decrypted : ${decrypted}`);
}
}
});
client.login(process.env.Token);