mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 05:49:49 +02:00
args and more
This commit is contained in:
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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
@@ -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
@@ -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];
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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’\n’sq': 'Albanian'\n'ar': 'Arabic’\n’hy': 'Armenian’\n’az': 'Azerbaijani’\n’eu': 'Basque’\n’be': 'Belarusian’\n’bn': 'Bengali’\n’bs': 'Bosnian’\n’bg': 'Bulgarian’\n’ca': 'Catalan’\n’ceb': 'Cebuano’\n’ny': 'Chichewa’\n’zh-cn': 'Chinese Simplified’\n’zh-tw': 'Chinese Traditional’\n’co': 'Corsican’\n’hr': 'Croatian’\n’cs': 'Czech’\n’da': 'Danish’\n’nl': 'Dutch’\n’en': 'English’\n’eo': 'Esperanto’\n’et': 'Estonian’\n’tl': 'Filipino’\n’fi': 'Finnish’\n’fr': 'French’\n’fy': 'Frisian’\n’gl': 'Galician’\n’ka': 'Georgian’\n’de': 'German’\n’el': 'Greek’\n’gu': 'Gujarati’\n’ht': 'Haitian Creole’\n’ha': 'Hausa’\n’haw': 'Hawaiian’\n’iw': 'Hebrew’\n’hi': 'Hindi’\n’hmn': 'Hmong’\n’hu': 'Hungarian’\n’is': 'Icelandic’\n’ig': 'Igbo’\n’id': 'Indonesian’\n’ga': 'Irish’\n’it': 'Italian’\n’ja': 'Japanese’\n’jw': 'Javanese’\n’kn': 'Kannada’\n’kk': 'Kazakh’\n’km': 'Khmer’\n’ko': 'Korean’\n’ku': 'Kurdish (Kurmanji)’\n’ky': 'Kyrgyz’\n’lo': 'Lao’\n’la': 'Latin’\n’lv': 'Latvian’\n’lt': 'Lithuanian’\n’lb': 'Luxembourgish’\n’mk': 'Macedonian’\n’mg': 'Malagasy’\n’ms': 'Malay’\n’ml': 'Malayalam’\n’mt': 'Maltese’\n’mi': 'Maori’\n’mr': 'Marathi’\n’mn': 'Mongolian’\n’my': 'Myanmar (Burmese)’\n’ne': 'Nepali’\n’no': 'Norwegian’\n’ps': 'Pashto’\n’fa': 'Persian’\n’pl': 'Polish’\n’pt': 'Portuguese’\n’ma': 'Punjabi’\n’ro': 'Romanian’\n’ru': 'Russian’\nsm': 'Samoan’\n’gd': 'Scots Gaelic’\n’sr': 'Serbian’\n’st': 'Sesotho’\n’sn': 'Shona’\n’sd': 'Sindhi’\n’si': 'Sinhala’\n’sk': 'Slovak’\n’sl': 'Slovenian’\n’so': 'Somali’\n’es': 'Spanish’\n’su': 'Sudanese’\n’sw': 'Swahili’\n’sv': 'Swedish’\n’tg': 'Tajik’\n’ta': 'Tamil’\n’te': 'Telugu’\n’th': 'Thai’\n’tr': 'Turkish’\n’uk': 'Ukrainian’\n’ur': 'Urdu’\n’uz': 'Uzbek’\n’vi': 'Vietnamese’\n’cy': 'Welsh’\n’xh': 'Xhosa’\n’yi': 'Yiddish’\n’yo': 'Yoruba’\n’zu': 'Zulu'");
|
||||
let languageto = args.to;
|
||||
let thingToTranslate = args.text;
|
||||
if (languageto === "list") return message.channel.send("‘af': 'Afrikaans’\n’sq': 'Albanian'\n'ar': 'Arabic’\n’hy': 'Armenian’\n’az': 'Azerbaijani’\n’eu': 'Basque’\n’be': 'Belarusian’\n’bn': 'Bengali’\n’bs': 'Bosnian’\n’bg': 'Bulgarian’\n’ca': 'Catalan’\n’ceb': 'Cebuano’\n’ny': 'Chichewa’\n’zh-cn': 'Chinese Simplified’\n’zh-tw': 'Chinese Traditional’\n’co': 'Corsican’\n’hr': 'Croatian’\n’cs': 'Czech’\n’da': 'Danish’\n’nl': 'Dutch’\n’en': 'English’\n’eo': 'Esperanto’\n’et': 'Estonian’\n’tl': 'Filipino’\n’fi': 'Finnish’\n’fr': 'French’\n’fy': 'Frisian’\n’gl': 'Galician’\n’ka': 'Georgian’\n’de': 'German’\n’el': 'Greek’\n’gu': 'Gujarati’\n’ht': 'Haitian Creole’\n’ha': 'Hausa’\n’haw': 'Hawaiian’\n’iw': 'Hebrew’\n’hi': 'Hindi’\n’hmn': 'Hmong’\n’hu': 'Hungarian’\n’is': 'Icelandic’\n’ig': 'Igbo’\n’id': 'Indonesian’\n’ga': 'Irish’\n’it': 'Italian’\n’ja': 'Japanese’\n’jw': 'Javanese’\n’kn': 'Kannada’\n’kk': 'Kazakh’\n’km': 'Khmer’\n’ko': 'Korean’\n’ku': 'Kurdish (Kurmanji)’\n’ky': 'Kyrgyz’\n’lo': 'Lao’\n’la': 'Latin’\n’lv': 'Latvian’\n’lt': 'Lithuanian’\n’lb': 'Luxembourgish’\n’mk': 'Macedonian’\n’mg': 'Malagasy’\n’ms': 'Malay’\n’ml': 'Malayalam’\n’mt': 'Maltese’\n’mi': 'Maori’\n’mr': 'Marathi’\n’mn': 'Mongolian’\n’my': 'Myanmar (Burmese)’\n’ne': 'Nepali’\n’no': 'Norwegian’\n’ps': 'Pashto’\n’fa': 'Persian’\n’pl': 'Polish’\n’pt': 'Portuguese’\n’ma': 'Punjabi’\n’ro': 'Romanian’\n’ru': 'Russian’\nsm': 'Samoan’\n’gd': 'Scots Gaelic’\n’sr': 'Serbian’\n’st': 'Sesotho’\n’sn': 'Shona’\n’sd': 'Sindhi’\n’si': 'Sinhala’\n’sk': 'Slovak’\n’sl': 'Slovenian’\n’so': 'Somali’\n’es': 'Spanish’\n’su': 'Sudanese’\n’sw': 'Swahili’\n’sv': 'Swedish’\n’tg': 'Tajik’\n’ta': 'Tamil’\n’te': 'Telugu’\n’th': 'Thai’\n’tr': 'Turkish’\n’uk': 'Ukrainian’\n’ur': 'Urdu’\n’uz': 'Uzbek’\n’vi': 'Vietnamese’\n’cy': 'Welsh’\n’xh': 'Xhosa’\n’yi': 'Yiddish’\n’yo': 'Yoruba’\n’zu': '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
@@ -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
@@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user