-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
35 lines (35 loc) · 1.03 KB
/
index.js
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
30
31
32
33
34
35
const {Plugin} = require('powercord/entities');
module.exports = class base64encoder extends Plugin {
startPlugin() {
powercord.api.commands.registerCommand({
command: 'encode',
description: 'It encodes a string from normal text to base 64',
usage: '{c} [--send] <message>',
executor: async (message) => {
let send = false;
if (message[0] == "--send") {message.shift(); send = true}
return {
send,
result: `${message.join(' ')} => \`${btoa(message.join(' '))}\``
};
}
});
powercord.api.commands.registerCommand({
command: 'decode',
description: 'It decodes a string from base 64 to normal text',
usage: '{c} [--send] <message>',
executor: async (message) => {
let send = false;
if (message[0] == "--send") {message.shift(); send = true}
return {
send,
result: `\`${message.join(' ')}\` => ${atob(message.join(' '))}`
};
}
});
}
pluginWillUnload() {
powercord.api.commands.unregisterCommand('encode');
powercord.api.commands.unregisterCommand('decode');
}
};