args and more

This commit is contained in:
Daniel Odendahl Jr
2017-03-25 04:16:27 +00:00
parent 8dd6ec1f9b
commit e2a4a92990
82 changed files with 1089 additions and 1021 deletions
+11 -4
View File
@@ -8,16 +8,23 @@ module.exports = class BinaryCommand extends commando.Command {
group: 'textedit',
memberName: 'binary',
description: 'Converts text to binary. (;binary This text)',
examples: [';binary This text']
examples: [';binary This text'],
args: [{
key: 'text',
prompt: 'What text would you like to convert to binary?',
type: 'string'
}]
});
}
run(message) {
run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let turnToBinary = message.content.split(" ").slice(1).join(" ");
return message.channel.send(stringToBinary(turnToBinary)).catch(error => message.channel.send(':x: Error! Translation is too long, or nothing was entered!'));
let turnToBinary = args.text;
let binaryText = stringToBinary(turnToBinary);
if (binaryText.length > 1950) return message.channel.send(":x: Error! Your message is too long!");
return message.channel.send(binaryText);
}
};
+13 -13
View File
@@ -8,25 +8,25 @@ module.exports = class CowsayCommand extends commando.Command {
group: 'textedit',
memberName: 'cowsay',
description: 'Converts text to cowsay. (;cowsay This text)',
examples: [';cowsay This text']
examples: [';cowsay This text'],
args: [{
key: 'text',
prompt: 'What text would you like the cow to say?',
type: 'string'
}]
});
}
run(message) {
run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
if (!message.content.split(" ").slice(1).join(" ")) {
return message.channel.send(":x: Error! You entered nothing!");
}
else {
let turnToCowsay = message.content.split(" ").slice(1).join(" ");
return message.channel.sendCode(null, cowsay.say({
text: turnToCowsay,
e: "oO",
T: "U "
})).catch(error => message.channel.send(':x: Error! Perhaps the content is too long?'));
}
let turnToCowsay = args.text;
return message.channel.sendCode(null, cowsay.say({
text: turnToCowsay,
e: "oO",
T: "U "
})).catch(error => message.channel.send(':x: Error! Perhaps the content is too long?'));
}
};
+16 -24
View File
@@ -8,37 +8,29 @@ module.exports = class EmbedCommand extends commando.Command {
group: 'textedit',
memberName: 'embed',
description: 'Sends a message in an embed. (;embed This is an example.)',
examples: [';embed This is an example.']
examples: [';embed This is an example.'],
guildOnly: true,
args: [{
key: 'text',
prompt: 'What text would you like to embed?',
type: 'string'
}]
});
}
run(message) {
async run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let embedMessage = message.content.split(" ").slice(1).join(" ");
if (!embedMessage) {
return message.channel.send(":x: Error! Nothing to embed!");
}
else {
if (message.channel.type === 'dm') {
const embed = new Discord.RichEmbed()
.setAuthor(message.author.username, message.author.avatarURL)
.setColor(0x00AE86)
.setTimestamp()
.setDescription(embedMessage);
return message.channel.sendEmbed(embed);
}
else {
const embed = new Discord.RichEmbed()
.setAuthor(message.author.username, message.author.avatarURL)
.setColor(0x00AE86)
.setTimestamp()
.setDescription(embedMessage);
message.delete();
return message.channel.sendEmbed(embed);
}
}
const embed = new Discord.RichEmbed()
.setAuthor(message.author.username, message.author.avatarURL)
.setColor(0x00AE86)
.setTimestamp()
.setDescription(embedMessage);
let deleteMsg = await message.delete();
let embedSend = await message.channel.sendEmbed(embed);
return [deleteMsg, embedSend];
}
};
+18 -16
View File
@@ -11,28 +11,30 @@ module.exports = class MorseCommand extends commando.Command {
group: 'textedit',
memberName: 'morse',
description: 'Translates text to and from morse code. (;morse encode This is Morse Code.)',
examples: [';morse encode This is Morse Code.', ';morse decode .... . .-.. .-.. --- --..-- ....... .-- --- .-. .-.. -.. .-.-.-']
examples: [';morse encode This is Morse Code.', ';morse decode .... . .-.. .-.. --- --..-- ....... .-- --- .-. .-.. -.. .-.-.-'],
args: [{
key: 'method',
prompt: 'Would you like to encode or decode the text?',
type: 'string',
validate: (str) => {
str.toLowerCase() === 'encode' || str.toLowerCase() === 'decode';
}
}, {
key: 'text',
prompt: 'What text would you like to convert to morse?',
type: 'string'
}]
});
}
run(message) {
run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let [methodToUse] = message.content.toLowerCase().split(" ").slice(1);
let toMorse = message.content.split(" ").slice(2).join(" ");
if (!toMorse) {
return message.channel.send(":x: Error! Nothing to translate! Perhaps you forgot to set the method? Use either encode or decode before your text.");
}
else if (methodToUse === 'encode') {
return message.channel.send(morse.encode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
}
else if (methodToUse === 'decode') {
return message.channel.send(morse.decode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
}
else {
return message.channel.send(":x: Error! Method not set/not correct! Use either encode or decode.");
}
let methodToUse = args.method;
let toMorse = args.text;
if (methodToUse === 'encode') return message.channel.send(morse.encode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
if (methodToUse === 'decode') return message.channel.send(morse.decode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
}
};
+10 -14
View File
@@ -12,27 +12,23 @@ module.exports = class PirateCommand extends commando.Command {
group: 'textedit',
memberName: 'pirate',
description: 'Talk like a pirate! (;pirate This is being said like a pirate!)',
examples: [';pirate This is being said like a pirate!']
examples: [';pirate This is being said like a pirate!'],
args: [{
key: 'text',
prompt: 'What text would you like to convert to pirate?',
type: 'string'
}]
});
}
run(message) {
run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let turnToPirate = message.content.split(" ").slice(1).join(" ");
let turnToPirate = args.text;
let pirate = pirateSpeak.translate(turnToPirate);
if (!turnToPirate) {
return message.channel.send(":x: Error! Nothing to translate!");
}
else {
if (pirate.length > 1950) {
return message.channel.send(":x: Error! Your message is too long!");
}
else {
return message.channel.send(pirate);
}
}
if (pirate.length > 1950) return message.channel.send(":x: Error! Your message is too long!");
return message.channel.send(pirate);
}
};
+10 -10
View File
@@ -7,22 +7,22 @@ module.exports = class ReverseCommand extends commando.Command {
group: 'textedit',
memberName: 'reverse',
description: 'Reverses text (;reverse This text please)',
examples: [';reverse This text please']
examples: [';reverse This text please'],
args: [{
key: 'text',
prompt: 'What text would you like to reverse?',
type: 'string'
}]
});
}
run(message) {
run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let stringToReverse = message.content.split(" ").slice(1).join(" ");
if (!stringToReverse) {
return message.channel.send(":x: Error! Nothing to reverse!");
}
else {
let reversed = stringToReverse.split("").reverse().join("");
return message.channel.send(reversed);
}
let stringToReverse = args.text;
let reversed = stringToReverse.split("").reverse().join("");
return message.channel.send(reversed);
}
};
+11 -6
View File
@@ -12,28 +12,33 @@ module.exports = class RinSayCommand extends commando.Command {
group: 'textedit',
memberName: 'rin',
description: "Posts a message to the Rin webhook in Heroes of Dreamland. (;rin Hey guys!)",
examples: [";rin Hey guys!"]
examples: [";rin Hey guys!"],
guildOnly: true,
args: [{
key: 'text',
prompt: 'What text would you like Rin to say?',
type: 'string'
}]
});
}
hasPermission(msg) {
return this.client.isOwner(msg.author);
}
async run(message) {
async run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'MANAGE_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let rinContent = message.content.split(" ").slice(1).join(" ");
let rinContent = args.text;
try {
let post = await request
.post(config.webhook)
.send({
content: rinContent
});
if (message.content.type !== 'dm') {
return message.delete();
}
let deleteMsg = await message.delete();
return [post, deleteMsg];
}
catch (err) {
return message.channel.send(':x: Error! Message failed to send!');
+14 -15
View File
@@ -11,27 +11,26 @@ module.exports = class RomajiCommand extends commando.Command {
group: 'textedit',
memberName: 'romaji',
description: 'Convert Hiragana and Katakana to Romaji (;romaji ひらがな)',
examples: [';romaji ひらがな']
examples: [';romaji ひらがな'],
args: [{
key: 'kana',
prompt: 'What kana would you like to convert to romaji?',
type: 'string',
validate: (str) => {
hepburn.containsKana(str);
}
}]
});
}
run(message) {
run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let romajify = message.content.split(" ").slice(1).join(" ");
if (hepburn.containsKana(romajify)) {
let romajified = hepburn.fromKana(romajify);
if (romajified.length > 1950) {
return message.channel.send(":x: Error! Your message is too long!");
}
else {
return message.channel.send(romajified);
}
}
else {
return message.channel.send(":x: Error! Message contains no Kana!\n:notepad_spiral: Note: You cannot use this command on Kanji!");
}
let romajify = args.kana;
let romajified = hepburn.fromKana(romajify);
if (romajified.length > 1950) return message.channel.send(":x: Error! Your message is too long!");
return message.channel.send(romajified);
}
};
+13 -16
View File
@@ -13,27 +13,24 @@ module.exports = class SayCommand extends commando.Command {
group: 'textedit',
memberName: 'say',
description: 'Make XiaoBot say what you wish. (;say I can talk!)',
examples: [';say I can talk!']
examples: [';say I can talk!'],
guildOnly: true,
args: [{
key: 'text',
prompt: 'What text would you like XiaoBot to say?',
type: 'string'
}]
});
}
run(message) {
async run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'MANAGE_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let copycat = message.content.split(" ").slice(1).join(" ");
if (!copycat) {
return message.channel.send(":x: Error! Nothing to say!");
}
else {
if (message.channel.type === 'dm') {
return message.channel.send(copycat);
}
else {
message.delete();
return message.channel.send(copycat);
}
}
let copycat = args.text;
let deleteMsg = await message.delete();
let copyMsg = await message.channel.send(copycat);
return [deleteMsg, copyMsg];
}
};
+9 -9
View File
@@ -19,21 +19,21 @@ module.exports = class ShuffleCommand extends commando.Command {
group: 'textedit',
memberName: 'shuffle',
description: 'Shuffles text (;shuffle This Text)',
examples: [';shuffle This Text']
examples: [';shuffle This Text'],
args: [{
key: 'text',
prompt: 'What text would you like to shuffle?',
type: 'string'
}]
});
}
run(message) {
run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let thingToShuffle = message.content.split(" ").slice(1).join(" ");
if (!thingToShuffle) {
return message.channel.send(":x: Error! Nothing to shuffle!");
}
else {
return message.channel.send(thingToShuffle.shuffle());
}
let thingToShuffle = args.text;
return message.channel.send(thingToShuffle.shuffle());
}
};
+10 -11
View File
@@ -286,7 +286,6 @@ const temmize = function(text) {
return temmify;
};
module.exports = class TemmieCommand extends commando.Command {
constructor(Client) {
super(Client, {
@@ -294,22 +293,22 @@ module.exports = class TemmieCommand extends commando.Command {
group: 'textedit',
memberName: 'temmie',
description: "Translate text to Temmie speak. (;temmie I am Temmie)",
examples: [";temmie I am Temmie."]
examples: [";temmie I am Temmie."],
args: [{
key: 'text',
prompt: 'What text would you like to convert to Temmie speak?',
type: 'string'
}]
});
}
run(message) {
run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let thingToTranslate = message.content.split(" ").slice(1).join(" ");
if (!thingToTranslate) {
return message.channel.send(':x: Error! Nothing to translate!');
}
else {
let temmized = temmize(thingToTranslate);
return message.channel.send(temmized);
}
let thingToTranslate = args.text;
let temmized = temmize(thingToTranslate);
return message.channel.send(temmized);
}
};
+32 -34
View File
@@ -116,48 +116,46 @@ module.exports = class TranslateCommand extends commando.Command {
group: 'textedit',
memberName: 'translate',
description: 'Translates text to a given language. (;translate ja Give me the money!)',
examples: [';translate ja Give me the the money!', ';translate list']
examples: [';translate ja Give me the the money!', ';translate list'],
args: [{
key: 'to',
prompt: 'What language would you like to translate to?',
type: 'string',
validate: (str) => {
languages[str] || str.toLowerCase() === 'list';
}
}, {
key: 'text',
prompt: 'What text would you like to translate?',
type: 'string'
}]
});
}
async run(message) {
async run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
}
console.log(`[Command] ${message.content}`);
let [languageto] = message.content.toLowerCase().split(" ").slice(1);
let thingToTranslate = message.content.split(" ").slice(2).join(" ");
if (languageto === "list") {
return message.channel.send("af': 'Afrikaans\nsq': 'Albanian'\n'ar': 'Arabic\nhy': 'Armenian\naz': 'Azerbaijani\neu': 'Basque\nbe': 'Belarusian\nbn': 'Bengali\nbs': 'Bosnian\nbg': 'Bulgarian\nca': 'Catalan\nceb': 'Cebuano\nny': 'Chichewa\nzh-cn': 'Chinese Simplified\nzh-tw': 'Chinese Traditional\nco': 'Corsican\nhr': 'Croatian\ncs': 'Czech\nda': 'Danish\nnl': 'Dutch\nen': 'English\neo': 'Esperanto\net': 'Estonian\ntl': 'Filipino\nfi': 'Finnish\nfr': 'French\nfy': 'Frisian\ngl': 'Galician\nka': 'Georgian\nde': 'German\nel': 'Greek\ngu': 'Gujarati\nht': 'Haitian Creole\nha': 'Hausa\nhaw': 'Hawaiian\niw': 'Hebrew\nhi': 'Hindi\nhmn': 'Hmong\nhu': 'Hungarian\nis': 'Icelandic\nig': 'Igbo\nid': 'Indonesian\nga': 'Irish\nit': 'Italian\nja': 'Japanese\njw': 'Javanese\nkn': 'Kannada\nkk': 'Kazakh\nkm': 'Khmer\nko': 'Korean\nku': 'Kurdish (Kurmanji)\nky': 'Kyrgyz\nlo': 'Lao\nla': 'Latin\nlv': 'Latvian\nlt': 'Lithuanian\nlb': 'Luxembourgish\nmk': 'Macedonian\nmg': 'Malagasy\nms': 'Malay\nml': 'Malayalam\nmt': 'Maltese\nmi': 'Maori\nmr': 'Marathi\nmn': 'Mongolian\nmy': 'Myanmar (Burmese)\nne': 'Nepali\nno': 'Norwegian\nps': 'Pashto\nfa': 'Persian\npl': 'Polish\npt': 'Portuguese\nma': 'Punjabi\nro': 'Romanian\nru': 'Russian\nsm': 'Samoan\ngd': 'Scots Gaelic\nsr': 'Serbian\nst': 'Sesotho\nsn': 'Shona\nsd': 'Sindhi\nsi': 'Sinhala\nsk': 'Slovak\nsl': 'Slovenian\nso': 'Somali\nes': 'Spanish\nsu': 'Sudanese\nsw': 'Swahili\nsv': 'Swedish\ntg': 'Tajik\nta': 'Tamil\nte': 'Telugu\nth': 'Thai\ntr': 'Turkish\nuk': 'Ukrainian\nur': 'Urdu\nuz': 'Uzbek\nvi': 'Vietnamese\ncy': 'Welsh\nxh': 'Xhosa\nyi': 'Yiddish\nyo': 'Yoruba\nzu': 'Zulu'");
let languageto = args.to;
let thingToTranslate = args.text;
if (languageto === "list") return message.channel.send("af': 'Afrikaans\nsq': 'Albanian'\n'ar': 'Arabic\nhy': 'Armenian\naz': 'Azerbaijani\neu': 'Basque\nbe': 'Belarusian\nbn': 'Bengali\nbs': 'Bosnian\nbg': 'Bulgarian\nca': 'Catalan\nceb': 'Cebuano\nny': 'Chichewa\nzh-cn': 'Chinese Simplified\nzh-tw': 'Chinese Traditional\nco': 'Corsican\nhr': 'Croatian\ncs': 'Czech\nda': 'Danish\nnl': 'Dutch\nen': 'English\neo': 'Esperanto\net': 'Estonian\ntl': 'Filipino\nfi': 'Finnish\nfr': 'French\nfy': 'Frisian\ngl': 'Galician\nka': 'Georgian\nde': 'German\nel': 'Greek\ngu': 'Gujarati\nht': 'Haitian Creole\nha': 'Hausa\nhaw': 'Hawaiian\niw': 'Hebrew\nhi': 'Hindi\nhmn': 'Hmong\nhu': 'Hungarian\nis': 'Icelandic\nig': 'Igbo\nid': 'Indonesian\nga': 'Irish\nit': 'Italian\nja': 'Japanese\njw': 'Javanese\nkn': 'Kannada\nkk': 'Kazakh\nkm': 'Khmer\nko': 'Korean\nku': 'Kurdish (Kurmanji)\nky': 'Kyrgyz\nlo': 'Lao\nla': 'Latin\nlv': 'Latvian\nlt': 'Lithuanian\nlb': 'Luxembourgish\nmk': 'Macedonian\nmg': 'Malagasy\nms': 'Malay\nml': 'Malayalam\nmt': 'Maltese\nmi': 'Maori\nmr': 'Marathi\nmn': 'Mongolian\nmy': 'Myanmar (Burmese)\nne': 'Nepali\nno': 'Norwegian\nps': 'Pashto\nfa': 'Persian\npl': 'Polish\npt': 'Portuguese\nma': 'Punjabi\nro': 'Romanian\nru': 'Russian\nsm': 'Samoan\ngd': 'Scots Gaelic\nsr': 'Serbian\nst': 'Sesotho\nsn': 'Shona\nsd': 'Sindhi\nsi': 'Sinhala\nsk': 'Slovak\nsl': 'Slovenian\nso': 'Somali\nes': 'Spanish\nsu': 'Sudanese\nsw': 'Swahili\nsv': 'Swedish\ntg': 'Tajik\nta': 'Tamil\nte': 'Telugu\nth': 'Thai\ntr': 'Turkish\nuk': 'Ukrainian\nur': 'Urdu\nuz': 'Uzbek\nvi': 'Vietnamese\ncy': 'Welsh\nxh': 'Xhosa\nyi': 'Yiddish\nyo': 'Yoruba\nzu': 'Zulu'");
if (thingToTranslate.length > 200) return message.channel.send(":x: Error! Please keep translations below 200 characters!");
try {
let res = await translate(thingToTranslate, {
to: languageto
});
let languagefrom = res.from.language.iso.toLowerCase();
const embed = new Discord.RichEmbed()
.setColor(0x00AE86)
.addField(`Input (From: ${languages[languagefrom]}):`,
thingToTranslate)
.addField(`Translation (To: ${languages[languageto]}):`,
res.text);
return message.channel.sendEmbed(embed);
}
else if (languages[languageto]) {
if (!thingToTranslate) {
return message.channel.send(":x: Error! Nothing to translate!");
}
else if (thingToTranslate.length > 200) {
return message.channel.send(":x: Error! Please keep translations below 200 characters!");
}
else {
try {
let res = await translate(thingToTranslate, {
to: languageto
});
let languagefrom = res.from.language.iso.toLowerCase();
const embed = new Discord.RichEmbed()
.setColor(0x00AE86)
.addField(`Input (From: ${languages[languagefrom]}):`,
thingToTranslate)
.addField(`Translation (To: ${languages[languageto]}):`,
res.text);
return message.channel.sendEmbed(embed);
}
catch (err) {
return message.channel.send(":x: Error! Something went wrong!");
}
}
}
else {
return message.channel.send(":x: Error! Language not found! Use `;translate list` to view a list of translate codes!");
catch (err) {
return message.channel.send(":x: Error! Something went wrong!");
}
}
};
+22 -26
View File
@@ -9,40 +9,36 @@ module.exports = class YodaCommand extends commando.Command {
group: 'textedit',
memberName: 'yoda',
description: 'Converts text to Yoda Speak. (;yoda This is Yoda.)',
examples: [';yoda This is Yoda.']
examples: [';yoda This is Yoda.'],
args: [{
key: 'text',
prompt: 'What text would you like to convert to Yoda speak?',
type: 'string'
}]
});
}
async run(message) {
async run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let turnToYoda = message.content.split(" ").slice(1).join(" ");
if (!turnToYoda) {
return message.channel.send(':x: Error! Nothing to translate!');
let turnToYoda = args.text;
try {
let response = await request
.get('https://yoda.p.mashape.com/yoda')
.set({
'X-Mashape-Key': config.mashapekey,
'Accept': 'text/plain'
})
.query({
sentence: turnToYoda
});
if (!response.text) return message.channel.send(':x: Error! Something went wrong! Keep it simple to avoid this error.');
return message.channel.send(response.text);
}
else {
try {
let response = await request
.get('https://yoda.p.mashape.com/yoda')
.set({
'X-Mashape-Key': config.mashapekey,
'Accept': 'text/plain'
})
.query({
sentence: turnToYoda
});
if (!response) {
return message.channel.send(':x: Error! Something went wrong! Keep it simple to avoid this error.');
}
else {
return message.channel.send(response.text);
}
}
catch (err) {
return message.channel.send(":x: Error! Something went wrong!");
}
catch (err) {
return message.channel.send(":x: Error! Something went wrong!");
}
}
};
+10 -12
View File
@@ -8,24 +8,22 @@ module.exports = class ZalgoCommand extends commando.Command {
group: 'textedit',
memberName: 'zalgo',
description: 'Zalgoizes Text (;zalgo This Text)',
examples: [';zalgo This Text']
examples: [';zalgo This Text'],
args: [{
key: 'text',
prompt: 'What text would you like to convert to zalgo?',
type: 'string'
}]
});
}
run(message) {
run(message, args) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
console.log(`[Command] ${message.content}`);
let zalgoified = zalgo(message.content.split(" ").slice(1).join(" "));
if (!zalgoified) {
return message.channel.send(":x: Error! Nothing to zalgoify!");
}
else if (zalgoified.length > 1950) {
return message.channel.send(":x: Error! Your message is too long!");
}
else {
return message.channel.send(zalgoified);
}
let zalgoified = zalgo(args.text);
if (zalgoified.length > 1950) return message.channel.send(":x: Error! Your message is too long!");
return message.channel.send(zalgoified);
}
};