mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-21 14:04:38 +02:00
50.0.0: Distort, Glitch, Aliases, Other stuff
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class AnagramCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'anagram',
|
||||
group: 'text-edit',
|
||||
memberName: 'anagram',
|
||||
description: 'Gets an anagram for a word.',
|
||||
args: [
|
||||
{
|
||||
key: 'word',
|
||||
prompt: 'What word would you like to get an anagram for?',
|
||||
type: 'string',
|
||||
parse: word => encodeURIComponent(word.toLowerCase())
|
||||
},
|
||||
{
|
||||
key: 'strict',
|
||||
prompt: 'Would you like to get only words that contain all letters?',
|
||||
type: 'boolean',
|
||||
default: true
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { word, strict }) {
|
||||
try {
|
||||
const { body } = await snekfetch.get(`http://www.anagramica.com/best/${word}`);
|
||||
const all = body.best.filter(anagram => anagram.toLowerCase() !== word);
|
||||
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.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -5,7 +5,7 @@ module.exports = class OrganizationXIIINameCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'organization-xiii-name',
|
||||
aliases: ['org-xiii-name', 'xiii-name', 'nobody-name'],
|
||||
aliases: ['org-xiii-name', 'xiii-name', 'nobody-name', 'organization-xiii', 'org-xiii', 'xiii'],
|
||||
group: 'text-edit',
|
||||
memberName: 'organization-xiii-name',
|
||||
description: 'Converts a name into the Organization XIII style.',
|
||||
|
||||
Reference in New Issue
Block a user