hex, base64, fix portal channels

This commit is contained in:
Daniel Odendahl Jr
2018-02-18 15:58:42 +00:00
parent 85706a395e
commit d3560d42e6
6 changed files with 110 additions and 2 deletions
+28
View File
@@ -0,0 +1,28 @@
const { Command } = require('discord.js-commando');
module.exports = class Base64Command extends Command {
constructor(client) {
super(client, {
name: 'base64',
aliases: ['base-64'],
group: 'text-edit',
memberName: 'base64',
description: 'Converts text to Base64.',
args: [
{
key: 'text',
prompt: 'What text would you like to convert to Base64?',
type: 'string',
validate: text => {
if (Buffer.from(text).toString('base64').length < 2000) return true;
return 'Invalid text, your text is too long.';
}
}
]
});
}
run(msg, { text }) {
return msg.say(Buffer.from(text).toString('base64'));
}
};
+28
View File
@@ -0,0 +1,28 @@
const { Command } = require('discord.js-commando');
module.exports = class HexCommand extends Command {
constructor(client) {
super(client, {
name: 'hex',
aliases: ['hexidecimal'],
group: 'text-edit',
memberName: 'hex',
description: 'Converts text to hex.',
args: [
{
key: 'text',
prompt: 'What text would you like to convert to hex?',
type: 'string',
validate: text => {
if (Buffer.from(text).toString('hex').length < 2000) return true;
return 'Invalid text, your text is too long.';
}
}
]
});
}
run(msg, { text }) {
return msg.say(Buffer.from(text).toString('hex'));
}
};
+28
View File
@@ -0,0 +1,28 @@
const { Command } = require('discord.js-commando');
module.exports = class URLEncodeCommand extends Command {
constructor(client) {
super(client, {
name: 'url-encode',
aliases: ['encode-url', 'encode-uri', 'uri-encode', 'encode-uri-component'],
group: 'text-edit',
memberName: 'url-encode',
description: 'Encodes text to URL-friendly characters.',
args: [
{
key: 'text',
prompt: 'What text would you like to encode?',
type: 'string',
validate: text => {
if (encodeURIComponent(text).length < 2000) return true;
return 'Invalid text, your text is too long.';
}
}
]
});
}
run(msg, { text }) {
return msg.say(encodeURIComponent(text));
}
};