mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-10 10:57:08 +02:00
Formatting
This commit is contained in:
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
|
||||
const stringToBinary = require('string-to-binary');
|
||||
|
||||
module.exports = class BinaryCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'binary',
|
||||
group: 'textedit',
|
||||
@@ -13,11 +13,11 @@ module.exports = class BinaryCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
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(" ");
|
||||
message.channel.send(stringToBinary(turnToBinary)).catch(error => message.channel.send(':x: Error! Translation is too long, or nothing was entered!'));
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
|
||||
const cowsay = require('cowsay');
|
||||
|
||||
module.exports = class CowsayCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'cowsay',
|
||||
group: 'textedit',
|
||||
@@ -13,21 +13,22 @@ module.exports = class CowsayCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
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(" ") === "") {
|
||||
if (message.content.split(" ").slice(1).join(" ") === "") {
|
||||
message.channel.send(":x: Error! You entered nothing!");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
let turnToCowsay = message.content.split(" ").slice(1).join(" ");
|
||||
message.channel.sendCode(null, cowsay.say({
|
||||
text : turnToCowsay,
|
||||
e : "oO",
|
||||
T : "U "
|
||||
text: turnToCowsay,
|
||||
e: "oO",
|
||||
T: "U "
|
||||
})).catch(error => {
|
||||
message.channel.send(':x: Error! Perhaps the content is too long?');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
+11
-10
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
|
||||
const Discord = require('discord.js');
|
||||
|
||||
module.exports = class EmbedCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'embed',
|
||||
group: 'textedit',
|
||||
@@ -13,22 +13,23 @@ module.exports = class EmbedCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
|
||||
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 === "") {
|
||||
if (embedMessage === "") {
|
||||
message.channel.send(":x: Error! Nothing to embed!");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setAuthor(message.author.username, message.author.avatarURL)
|
||||
.setColor(0x00AE86)
|
||||
.setTimestamp()
|
||||
.setDescription(embedMessage);
|
||||
.setAuthor(message.author.username, message.author.avatarURL)
|
||||
.setColor(0x00AE86)
|
||||
.setTimestamp()
|
||||
.setDescription(embedMessage);
|
||||
message.channel.sendEmbed(embed).catch(console.error);
|
||||
if (message.channel.type === 'dm') return;
|
||||
message.delete();
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -105,4 +105,4 @@
|
||||
"yo": "Yoruba",
|
||||
"zu": "Zulu"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
|
||||
const morse = require('morse');
|
||||
|
||||
module.exports = class MorseCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'morse',
|
||||
aliases: [
|
||||
@@ -16,20 +16,23 @@ module.exports = class MorseCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
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 === "") {
|
||||
if (toMorse === "") {
|
||||
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') {
|
||||
}
|
||||
else if (methodToUse === 'encode') {
|
||||
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') {
|
||||
}
|
||||
else if (methodToUse === 'decode') {
|
||||
message.channel.send(morse.decode(toMorse)).catch(error => message.channel.send(':x: Error! Something went wrong! Perhaps you entered incorrect text?'));
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
message.channel.send(":x: Error! Method not set/not correct! Use either encode or decode.");
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
|
||||
const pirateSpeak = require('pirate-speak');
|
||||
|
||||
module.exports = class PirateCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'pirate',
|
||||
aliases: [
|
||||
@@ -17,20 +17,22 @@ module.exports = class PirateCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
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 pirate = pirateSpeak.translate(turnToPirate);
|
||||
if(turnToPirate === "") {
|
||||
if (turnToPirate === "") {
|
||||
message.channel.send(":x: Error! Nothing to translate!");
|
||||
} else {
|
||||
if(pirate.length > 1950) {
|
||||
}
|
||||
else {
|
||||
if (pirate.length > 1950) {
|
||||
message.channel.send(":x: Error! Your message is too long!");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
message.channel.send(pirate);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const commando = require('discord.js-commando');
|
||||
|
||||
module.exports = class ReverseCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'reverse',
|
||||
group: 'textedit',
|
||||
@@ -12,16 +12,17 @@ module.exports = class ReverseCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
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 === "") {
|
||||
if (stringToReverse === "") {
|
||||
message.channel.send(":x: Error! Nothing to reverse!");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
let reversed = stringToReverse.split("").reverse().join("");
|
||||
message.channel.send(reversed);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
+18
-16
@@ -3,7 +3,7 @@ const request = require('superagent');
|
||||
const config = require('../../config.json');
|
||||
|
||||
module.exports = class RinSayCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'rin',
|
||||
aliases: [
|
||||
@@ -15,25 +15,27 @@ module.exports = class RinSayCommand extends commando.Command {
|
||||
examples: [";rin Hey guys!"]
|
||||
});
|
||||
}
|
||||
hasPermission(msg) {
|
||||
return this.client.isOwner(msg.author);
|
||||
}
|
||||
hasPermission(msg) {
|
||||
return this.client.isOwner(msg.author);
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
let rinContent = message.content.split(" ").slice(1).join(" ");
|
||||
request
|
||||
.post(config.webhook)
|
||||
.send({ content: rinContent })
|
||||
.then(function (parsedBody) {
|
||||
if(message.content.type === 'dm') return;
|
||||
message.delete();
|
||||
}).catch(function (err) {
|
||||
message.channel.send(':x: Error! Message failed to send! Check the logs for details.');
|
||||
console.log(err);
|
||||
});
|
||||
.post(config.webhook)
|
||||
.send({
|
||||
content: rinContent
|
||||
})
|
||||
.then(function(parsedBody) {
|
||||
if (message.content.type === 'dm') return;
|
||||
message.delete();
|
||||
}).catch(function(err) {
|
||||
message.channel.send(':x: Error! Message failed to send! Check the logs for details.');
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
|
||||
const hepburn = require('hepburn');
|
||||
|
||||
module.exports = class RomajiCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'romaji',
|
||||
aliases: [
|
||||
@@ -16,20 +16,22 @@ module.exports = class RomajiCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
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)) {
|
||||
if (hepburn.containsKana(romajify)) {
|
||||
let romajified = hepburn.fromKana(romajify);
|
||||
if(romajified.length > 1950) {
|
||||
if (romajified.length > 1950) {
|
||||
message.channel.send(":x: Error! Your message is too long!");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
message.channel.send(romajified);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
message.channel.send(":x: Error! Message contains no Kana!\n:notepad_spiral: Note: You cannot use this command on Kanji!");
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const commando = require('discord.js-commando');
|
||||
|
||||
module.exports = class SayCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'say',
|
||||
aliases: [
|
||||
@@ -17,17 +17,18 @@ module.exports = class SayCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log("[Command] " + message.content);
|
||||
let copycat = message.content.split(" ").slice(1).join(" ");
|
||||
if(copycat === "") {
|
||||
if (copycat === "") {
|
||||
message.channel.send(":x: Error! Nothing to say!");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
message.channel.send(copycat);
|
||||
if (message.channel.type === 'dm') return;
|
||||
message.delete();
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -150,7 +150,8 @@ function translator(text) {
|
||||
let character = text[i];
|
||||
if (isLetter(character)) {
|
||||
word += character;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if (word != "") {
|
||||
let wordTranslate = translateWord(word);
|
||||
translatedText += wordTranslate;
|
||||
@@ -168,7 +169,7 @@ function translator(text) {
|
||||
const temmize = function(text) {
|
||||
let currentTranslation = translator(text);
|
||||
let temmify = currentTranslation.split("ing").join("in").split("!").join("!!!!111!11!1!!!1!!!1111!").split("'").join("");
|
||||
|
||||
|
||||
return temmify;
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ const translate = require('google-translate-api');
|
||||
const languages = require('./languages.json');
|
||||
|
||||
module.exports = class TranslateCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'translate',
|
||||
group: 'textedit',
|
||||
@@ -15,35 +15,41 @@ module.exports = class TranslateCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
|
||||
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") {
|
||||
if (languageto === "list") {
|
||||
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'");
|
||||
} else if(languages.entries[languageto]) {
|
||||
if(thingToTranslate === "") {
|
||||
}
|
||||
else if (languages.entries[languageto]) {
|
||||
if (thingToTranslate === "") {
|
||||
message.channel.send(":x: Error! Nothing to translate!");
|
||||
} else if(thingToTranslate.length > 200) {
|
||||
}
|
||||
else if (thingToTranslate.length > 200) {
|
||||
message.channel.send(":x: Error! Please keep translations below 200 characters!");
|
||||
} else {
|
||||
translate(thingToTranslate, {to: languageto}).then(res => {
|
||||
}
|
||||
else {
|
||||
translate(thingToTranslate, {
|
||||
to: languageto
|
||||
}).then(res => {
|
||||
let languagefrom = res.from.language.iso.toLowerCase();
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setColor(0x00AE86)
|
||||
.addField('Input (From: ' + languages.entries[languagefrom] + '):',
|
||||
thingToTranslate)
|
||||
.addField('Translation (To: ' + languages.entries[languageto] + '):',
|
||||
res.text);
|
||||
.setColor(0x00AE86)
|
||||
.addField('Input (From: ' + languages.entries[languagefrom] + '):',
|
||||
thingToTranslate)
|
||||
.addField('Translation (To: ' + languages.entries[languageto] + '):',
|
||||
res.text);
|
||||
message.channel.sendEmbed(embed).catch(console.error);
|
||||
}).catch(err => {
|
||||
message.channel.send(":x: Error! Something went wrong!");
|
||||
});
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
message.channel.send(":x: Error! Language not found! Use `;translate list` to view a list of translate codes!");
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
+25
-18
@@ -3,7 +3,7 @@ const request = require('superagent');
|
||||
const config = require('../../config.json');
|
||||
|
||||
module.exports = class YodaCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'yoda',
|
||||
group: 'textedit',
|
||||
@@ -14,27 +14,34 @@ module.exports = class YodaCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
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 === "") {
|
||||
if (turnToYoda === "") {
|
||||
message.channel.send(':x: Error! Nothing to translate!');
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
request
|
||||
.get('https://yoda.p.mashape.com/yoda')
|
||||
.set({ 'X-Mashape-Key': config.mashapekey, 'Accept': 'text/plain' })
|
||||
.query({ sentence: turnToYoda })
|
||||
.then(function (response) {
|
||||
if(response === undefined) {
|
||||
message.channel.send(':x: Error! Something went wrong! Keep it simple to avoid this error.');
|
||||
} else {
|
||||
message.channel.send(response.text).catch(error => message.channel.send(':x: Error! Something went wrong! Keep it simple to avoid this error.'));
|
||||
}
|
||||
}).catch(function (err) {
|
||||
message.channel.send(":x: Error! Unknown Error. Try again later!");
|
||||
});
|
||||
.get('https://yoda.p.mashape.com/yoda')
|
||||
.set({
|
||||
'X-Mashape-Key': config.mashapekey,
|
||||
'Accept': 'text/plain'
|
||||
})
|
||||
.query({
|
||||
sentence: turnToYoda
|
||||
})
|
||||
.then(function(response) {
|
||||
if (response === undefined) {
|
||||
message.channel.send(':x: Error! Something went wrong! Keep it simple to avoid this error.');
|
||||
}
|
||||
else {
|
||||
message.channel.send(response.text).catch(error => message.channel.send(':x: Error! Something went wrong! Keep it simple to avoid this error.'));
|
||||
}
|
||||
}).catch(function(err) {
|
||||
message.channel.send(":x: Error! Unknown Error. Try again later!");
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,7 +2,7 @@ const commando = require('discord.js-commando');
|
||||
const zalgo = require('zalgolize');
|
||||
|
||||
module.exports = class ZalgoCommand extends commando.Command {
|
||||
constructor(Client){
|
||||
constructor(Client) {
|
||||
super(Client, {
|
||||
name: 'zalgo',
|
||||
group: 'textedit',
|
||||
@@ -13,17 +13,19 @@ module.exports = class ZalgoCommand extends commando.Command {
|
||||
}
|
||||
|
||||
async run(message) {
|
||||
if(message.channel.type !== 'dm') {
|
||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
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 === '') {
|
||||
if (zalgoified === '') {
|
||||
message.channel.send(":x: Error! Nothing to zalgoify!");
|
||||
} else if(zalgoified.length > 1950) {
|
||||
}
|
||||
else if (zalgoified.length > 1950) {
|
||||
message.channel.send(":x: Error! Your message is too long!");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
message.channel.send(zalgoified);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user