mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 08:22:22 +02:00
Fixes and Prepare for Bug Checks
This commit is contained in:
@@ -22,7 +22,7 @@ module.exports = class NitroCommand extends commando.Command {
|
|||||||
.setThumbnail('https://pbs.twimg.com/profile_images/814184180649197568/y2eZcVMq.jpg')
|
.setThumbnail('https://pbs.twimg.com/profile_images/814184180649197568/y2eZcVMq.jpg')
|
||||||
.setColor(0x748BD9)
|
.setColor(0x748BD9)
|
||||||
.setURL('https://discordapp.com/nitro')
|
.setURL('https://discordapp.com/nitro')
|
||||||
.setDescription('This Message can only be viewed by members with Discord Nitro.\n\n[More Information](https://discordapp.com/nitro)');
|
.setDescription('This Message can only be viewed by members with Discord Nitro.\n\n\n[More Information](https://discordapp.com/nitro)');
|
||||||
return message.embed(embed);
|
return message.embed(embed);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,22 +10,18 @@ module.exports = class MorseCommand extends commando.Command {
|
|||||||
],
|
],
|
||||||
group: 'textedit',
|
group: 'textedit',
|
||||||
memberName: 'morse',
|
memberName: 'morse',
|
||||||
description: 'Translates text to and from morse code. (;morse encode This is Morse Code.)',
|
description: 'Translates text to morse code. (;morse This is Morse Code.)',
|
||||||
examples: [';morse encode This is Morse Code.', ';morse decode .... . .-.. .-.. --- --..-- ....... .-- --- .-. .-.. -.. .-.-.-'],
|
examples: [';morse This is Morse Code.'],
|
||||||
args: [{
|
args: [{
|
||||||
key: 'method',
|
key: 'text',
|
||||||
prompt: 'Would you like to encode or decode the text?',
|
prompt: 'What text would you like to convert to morse?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: method => {
|
validate: content => {
|
||||||
if (method.toLowerCase() === 'encode' || method.toLowerCase() === 'decode') {
|
if (morse.encode(content).length < 1900) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return 'Please enter either `encode` or `decode`.';
|
return 'Your text to encode is too long.';
|
||||||
}
|
}
|
||||||
}, {
|
|
||||||
key: 'text',
|
|
||||||
prompt: 'What text would you like to convert to/from morse?',
|
|
||||||
type: 'string'
|
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -35,13 +31,8 @@ module.exports = class MorseCommand extends commando.Command {
|
|||||||
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'])) return;
|
||||||
}
|
}
|
||||||
console.log(`[Command] ${message.content}`);
|
console.log(`[Command] ${message.content}`);
|
||||||
const methodToUse = args.method.toLowerCase();
|
|
||||||
const toMorse = args.text;
|
const toMorse = args.text;
|
||||||
if (methodToUse === 'encode') {
|
const morseEncoded = morse.encode(toMorse);
|
||||||
return message.say(morse.encode(toMorse)).catch(error => message.say(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
|
return message.say(morseEncoded);
|
||||||
}
|
|
||||||
else if (methodToUse === 'decode') {
|
|
||||||
return message.say(morse.decode(toMorse)).catch(error => message.say(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ module.exports = class TranslateCommand extends commando.Command {
|
|||||||
return message.embed(embed);
|
return message.embed(embed);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
console.error(err);
|
||||||
return message.say(':x: Error! Something went wrong!');
|
return message.say(':x: Error! Something went wrong!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ module.exports = class YodaCommand extends commando.Command {
|
|||||||
return message.say(response.text);
|
return message.say(response.text);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
|
console.error(err);
|
||||||
return message.say(':x: Error! Something went wrong!');
|
return message.say(':x: Error! Something went wrong!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user