mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 05:54:33 +02:00
Small changes, reply to some things
This commit is contained in:
@@ -28,15 +28,13 @@ module.exports = class AnagramCommand extends Command {
|
||||
async run(msg, { word, strict }) {
|
||||
try {
|
||||
const { body } = await snekfetch.get(`http://www.anagramica.com/best/${word}`);
|
||||
if (!body.best.length) return msg.say('Could not find any results.');
|
||||
const all = body.best.filter(anagram => anagram.toLowerCase() !== word);
|
||||
if (!all.length) return msg.say('Could not find any results.');
|
||||
const words = strict ? all.filter(anagram => anagram.length === word.length) : all;
|
||||
if (!words.length) return msg.say('Could not find any results.');
|
||||
return msg.say(words[Math.floor(Math.random() * words.length)]);
|
||||
} catch (err) {
|
||||
if (err.status === 500) return msg.say('Could not find any results.');
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@ module.exports = class CowSayCommand extends Command {
|
||||
});
|
||||
return msg.code(null, body.cow);
|
||||
} catch (err) {
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -52,7 +52,7 @@ module.exports = class DECTalkCommand extends Command {
|
||||
return null;
|
||||
} catch (err) {
|
||||
await this.finish(file, channel);
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ module.exports = class PortalSendCommand extends Command {
|
||||
await channel.send(`**${msg.author.tag} (${msg.guild.name})**: ${text}`);
|
||||
return msg.say(`Message sent to **${channel.name}** in **${channel.guild.name}**!`);
|
||||
} catch (err) {
|
||||
return msg.say('Failed to send the message. Try again later!');
|
||||
return msg.reply('Failed to send the message. Try again later!');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -10,6 +10,7 @@ module.exports = class ShipNameCommand extends Command {
|
||||
args: [
|
||||
{
|
||||
key: 'start',
|
||||
label: 'start name',
|
||||
prompt: 'What name should be at the start of the ship name?',
|
||||
type: 'string',
|
||||
validate: start => {
|
||||
@@ -20,6 +21,7 @@ module.exports = class ShipNameCommand extends Command {
|
||||
},
|
||||
{
|
||||
key: 'end',
|
||||
label: 'end name',
|
||||
prompt: 'What name should be at the end of the ship name?',
|
||||
type: 'string',
|
||||
validate: end => {
|
||||
|
||||
@@ -79,7 +79,7 @@ module.exports = class TranslateCommand extends Command {
|
||||
body.text[0]);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -30,10 +30,10 @@ module.exports = class YodaCommand extends Command {
|
||||
.get('https://yoda.p.mashape.com/yoda')
|
||||
.query({ sentence })
|
||||
.set({ 'X-Mashape-Key': MASHAPE_KEY });
|
||||
if (!text) return msg.say('Empty, this message is. Try again later, you must.');
|
||||
if (!text) return msg.reply('Empty, this message is. Try again later, you must.');
|
||||
return msg.say(text);
|
||||
} catch (err) {
|
||||
return msg.say(`Being a jerk again, Yoda is: \`${err.message}\`. Try again later, you must.`);
|
||||
return msg.reply(`Being a jerk again, Yoda is: \`${err.message}\`. Try again later, you must.`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user