mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix All the Crap
This commit is contained in:
@@ -13,10 +13,7 @@ module.exports = class MathGameCommand extends commando.Command {
|
||||
args: [{
|
||||
key: 'difficulty',
|
||||
prompt: 'What difficulty should the math game be? Easy, Medium, Hard, or Extreme?',
|
||||
type: 'string',
|
||||
validate: (str) => {
|
||||
str.toLowerCase() === 'easy' || str.toLowerCase() === 'medium' || str.toLowerCase() === 'hard' || str.toLowerCase() === 'extreme';
|
||||
}
|
||||
type: 'string'
|
||||
}]
|
||||
});
|
||||
}
|
||||
@@ -26,7 +23,8 @@ module.exports = class MathGameCommand extends commando.Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
|
||||
}
|
||||
console.log(`[Command] ${message.content}`);
|
||||
let level = args.difficulty;
|
||||
let level = args.difficulty.toLowerCase();
|
||||
if (level !== 'easy' || level !== 'medium' || level !== 'hard' || level !== 'extreme') return message.channel.send(':x: Error! Please set the difficulty to either easy, medium, hard, or extreme!');
|
||||
let randomType = ['+', '-', '*'];
|
||||
randomType = randomType[Math.floor(Math.random() * randomType.length)];
|
||||
let randomValue;
|
||||
|
||||
@@ -15,9 +15,6 @@ module.exports = class RockPaperScissors extends commando.Command {
|
||||
key: 'choice',
|
||||
prompt: 'Rock, Paper, or Scissors?',
|
||||
type: 'string',
|
||||
validate: (str) => {
|
||||
str.toLowerCase() === 'rock' || str.toLowerCase() === 'paper' || str.toLowerCase() === 'scissors';
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
@@ -27,7 +24,7 @@ module.exports = class RockPaperScissors extends commando.Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log(`[Command] ${message.content}`);
|
||||
let rps = args.choice;
|
||||
let rps = args.choice.toLowerCase();
|
||||
let response = ['Paper', 'Rock', 'Scissors'];
|
||||
response = response[Math.floor(Math.random() * response.length)];
|
||||
if (rps.includes("rock")) {
|
||||
@@ -63,5 +60,6 @@ module.exports = class RockPaperScissors extends commando.Command {
|
||||
return message.channel.send("Scissors! Aw, it's a tie!");
|
||||
}
|
||||
}
|
||||
else return message.channel.send(':x: Error! Please enter rock, paper, or scissors!');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,10 +12,7 @@ module.exports = class TypingGameCommand extends commando.Command {
|
||||
args: [{
|
||||
key: 'difficulty',
|
||||
prompt: 'What difficulty should the typing game be? Easy, Medium, Hard, or Extreme?',
|
||||
type: 'string',
|
||||
validate: (str) => {
|
||||
str.toLowerCase() === 'easy' || str.toLowerCase() === 'medium' || str.toLowerCase() === 'hard' || str.toLowerCase() === 'extreme';
|
||||
}
|
||||
type: 'string'
|
||||
}]
|
||||
});
|
||||
}
|
||||
@@ -25,7 +22,8 @@ module.exports = class TypingGameCommand extends commando.Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'EMBED_LINKS'])) return;
|
||||
}
|
||||
console.log(`[Command] ${message.content}`);
|
||||
let level = args.difficulty;
|
||||
let level = args.difficulty.toLowerCase();
|
||||
if (level !== 'easy' || level !== 'medium' || level !== 'hard' || level !== 'extreme') return message.channel.send(':x: Error! Please set the difficulty to either easy, medium, hard, or extreme!');
|
||||
let randomSentence = ['The quick brown fox jumps over the lazy dog.', 'Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.', 'How razorback-jumping frogs can level six piqued gymnasts!', 'Amazingly few discotheques provide jukeboxes.'];
|
||||
randomSentence = randomSentence[Math.floor(Math.random() * randomSentence.length)];
|
||||
let time;
|
||||
|
||||
@@ -112,17 +112,11 @@ module.exports = class MemeCommand extends commando.Command {
|
||||
args: [{
|
||||
key: 'type',
|
||||
prompt: 'What meme type do you want to use?',
|
||||
type: 'string',
|
||||
validate: (str) => {
|
||||
memecodes[str] || str === 'list';
|
||||
}
|
||||
type: 'string'
|
||||
}, {
|
||||
key: 'content',
|
||||
prompt: 'What should the meme content be?',
|
||||
type: 'string',
|
||||
validate: (str) => {
|
||||
str.includes(" | ") && str.match(/^[a-zA-Z0-9|.,!?'-\s]+$/);
|
||||
}
|
||||
type: 'string'
|
||||
}]
|
||||
});
|
||||
}
|
||||
@@ -132,8 +126,10 @@ module.exports = class MemeCommand extends commando.Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES', 'ATTACH_FILES'])) return;
|
||||
}
|
||||
console.log(`[Command] ${message.content}`);
|
||||
let type = args.type;
|
||||
let type = args.type.toLowerCase();
|
||||
if (!memecodes[type] || type !== 'list') return message.channel.send(':x: Error! Meme type not found! Use `;meme list` to view a list of meme types.');
|
||||
let content = args.content;
|
||||
if (!content.includes(' | ') || !content.match(/^[a-zA-Z0-9|.,!?'-\s]+$/)) return message.channel.send(':x: Error! Invalid content! Split your choices with a " | " or do not use special characters!');
|
||||
if (type === "list") return message.channel.send("**Type Codes:** tenguy, afraid, older, aag, tried, biw, blb, kermit, bd, ch, cbg, wonka, cb, keanu, dsm, live, ants, doge, alwaysonbeat, ermg, facepalm, fwp, fa, fbf, fry, hipster, icanhas, crazypills, mw, noidea, regret, boat, hagrid, sohappy, captain, inigo, iw, ackbar, happening, joker, ive, ll, morpheus, mb, badchoice, mmm, jetpack, red, mordor, oprah, oag, remembers, philosoraptor, jw, patrick, rollsafe, sad-obama, sad-clinton, sadfrog, sad-bush, sad-biden, sad-boehner, saltbae, sarcasticbear, dwight, sb, ss, sf, dodgson, money, sohot, nice, awesome-awkward, awesome, awkward-awesome, awkward, fetch, success, scc, ski, officespace, interesting, toohigh, bs, center, both, winter, xy, buzz, yodawg, uno, yallgot, bad, elf, chosen");
|
||||
let memeQuery = content.split(" ").join("-").split("-|-");
|
||||
let toprow = memeQuery[0].split("?").join("~q");
|
||||
|
||||
@@ -27,7 +27,9 @@ module.exports = class ChooseCommand extends commando.Command {
|
||||
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||
}
|
||||
console.log(`[Command] ${message.content}`);
|
||||
let choices = args.choices.split(' | ');
|
||||
let choices = args.choices;
|
||||
if (!choices.includes(' | ')) return message.channel.send(':x: Error! Split your messages with a " | "!');
|
||||
choices = choices.split(" | ");
|
||||
choices = choices[Math.floor(Math.random() * choices.length)];
|
||||
return message.channel.send(`I choose ${choices}!`);
|
||||
}
|
||||
|
||||
@@ -15,10 +15,7 @@ module.exports = class RandomNameGen extends commando.Command {
|
||||
args: [{
|
||||
key: 'gender',
|
||||
prompt: 'Which gender do you want to generate a name for?',
|
||||
type: 'string',
|
||||
validate: (str) => {
|
||||
str.toLowerCase() === 'male' || str.toLowerCase() === 'female';
|
||||
}
|
||||
type: 'string'
|
||||
}]
|
||||
});
|
||||
}
|
||||
@@ -41,5 +38,8 @@ module.exports = class RandomNameGen extends commando.Command {
|
||||
else if (gender === "female") {
|
||||
return message.channel.send(`${randomFirstFemale} ${randomLast}`);
|
||||
}
|
||||
else {
|
||||
return message.channel.send(':x: Error! Please set either male or female!');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -16,10 +16,7 @@ module.exports = class DiscrimCommand extends commando.Command {
|
||||
args: [{
|
||||
key: 'discrim',
|
||||
prompt: 'Which discriminator would you like to search for?',
|
||||
type: 'string',
|
||||
validate: (str) => {
|
||||
str.match(/^[0-9]+$/) && str.length === 4;
|
||||
}
|
||||
type: 'string'
|
||||
}]
|
||||
});
|
||||
}
|
||||
@@ -30,6 +27,7 @@ module.exports = class DiscrimCommand extends commando.Command {
|
||||
}
|
||||
console.log(`[Command] ${message.content}`);
|
||||
let userToSearch = args.discrim;
|
||||
if (!userToSearch.match(/^[0-9]+$/) || userToSearch.length !== 4) return message.channel.send(':x: Error! Invalid Discriminator!');
|
||||
let users = await this.client.users.filter(u => u.discriminator === userToSearch).map(u => u.username).sort();
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setTitle(`${users.length} Users with the discriminator: ${userToSearch}`)
|
||||
|
||||
@@ -16,10 +16,7 @@ module.exports = class PokedexCommand extends commando.Command {
|
||||
args: [{
|
||||
key: 'pokemon',
|
||||
prompt: 'What Pokémon would you like to get info on?',
|
||||
type: 'string',
|
||||
validate: (str) => {
|
||||
pokedex.name[str.toLowerCase()];
|
||||
}
|
||||
type: 'string'
|
||||
}]
|
||||
});
|
||||
}
|
||||
@@ -30,6 +27,7 @@ module.exports = class PokedexCommand extends commando.Command {
|
||||
}
|
||||
console.log(`[Command] ${message.content}`);
|
||||
let pokemon = args.pokemon;
|
||||
if (!pokedex.name[pokemon.toLowerCase()]) return message.channel.send(':x: Error! This Pokémon is either not valid, or is not yet implemented!');
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setTitle('Information')
|
||||
.setAuthor(`#${pokedex.index[pokemon]} ${pokedex.name[pokemon]}`, `http://www.serebii.net/pokedex-sm/icon/${pokedex.index[pokemon]}.png`)
|
||||
|
||||
@@ -15,10 +15,7 @@ module.exports = class MorseCommand extends commando.Command {
|
||||
args: [{
|
||||
key: 'method',
|
||||
prompt: 'Would you like to encode or decode the text?',
|
||||
type: 'string',
|
||||
validate: (str) => {
|
||||
str.toLowerCase() === 'encode' || str.toLowerCase() === 'decode';
|
||||
}
|
||||
type: 'string'
|
||||
}, {
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to convert to morse?',
|
||||
@@ -33,6 +30,7 @@ module.exports = class MorseCommand extends commando.Command {
|
||||
}
|
||||
console.log(`[Command] ${message.content}`);
|
||||
let methodToUse = args.method;
|
||||
if (methodToUse.toLowerCase() !== 'encode' || methodToUse.toLowerCase() !== 'decode') return message.channel.send(':x: Error! Please set either encode or decode!');
|
||||
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?'));
|
||||
|
||||
@@ -15,10 +15,7 @@ module.exports = class RomajiCommand extends commando.Command {
|
||||
args: [{
|
||||
key: 'kana',
|
||||
prompt: 'What kana would you like to convert to romaji?',
|
||||
type: 'string',
|
||||
validate: (str) => {
|
||||
hepburn.containsKana(str);
|
||||
}
|
||||
type: 'string'
|
||||
}]
|
||||
});
|
||||
}
|
||||
@@ -29,6 +26,7 @@ module.exports = class RomajiCommand extends commando.Command {
|
||||
}
|
||||
console.log(`[Command] ${message.content}`);
|
||||
let romajify = args.kana;
|
||||
if (!hepburn.containsKana(romajify)) return message.channel.send(':x: Error! Message contains no Katakana or Hiragana!');
|
||||
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);
|
||||
|
||||
@@ -120,10 +120,7 @@ module.exports = class TranslateCommand extends commando.Command {
|
||||
args: [{
|
||||
key: 'to',
|
||||
prompt: 'What language would you like to translate to?',
|
||||
type: 'string',
|
||||
validate: (str) => {
|
||||
languages[str] || str.toLowerCase() === 'list';
|
||||
}
|
||||
type: 'string'
|
||||
}, {
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to translate?',
|
||||
@@ -138,6 +135,7 @@ module.exports = class TranslateCommand extends commando.Command {
|
||||
}
|
||||
console.log(`[Command] ${message.content}`);
|
||||
let languageto = args.to;
|
||||
if (!languages[languageto] || languageto.toLowerCase() !== 'list') return message.channel.send(':x: Error! Translation type is not valid!');
|
||||
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!");
|
||||
|
||||
@@ -38,19 +38,20 @@ client.registry
|
||||
})
|
||||
.registerCommandsIn(path.join(__dirname, 'commands'));
|
||||
|
||||
client.on('message', message => {
|
||||
client.on('message', (message) => {
|
||||
if (message.author.bot) return;
|
||||
if (message.channel.type === 'dm') return;
|
||||
if (!message.content.startsWith(`<@${client.user.id}>`)) {
|
||||
if (message.guild.id !== config.server || message.guild.id !== config.personalServer || message.author.id !== config.owner) return;
|
||||
if (clevusers.allowed[message.author.id]) {
|
||||
let cleverMessage = message.content.replace(`<@${client.user.id}>`, "");
|
||||
console.log(`[Cleverbot] ${cleverMessage}`);
|
||||
message.channel.startTyping();
|
||||
cleverbot.write(cleverMessage, function(response) {
|
||||
message.reply(response.output);
|
||||
message.channel.stopTyping();
|
||||
});
|
||||
if (message.content.startsWith(`<@${client.user.id}>`)) {
|
||||
if (message.guild.id === config.server || message.guild.id === config.personalServer || message.author.id === config.owner) {
|
||||
if (message.author.id === clevusers.allowed[message.author.id]) {
|
||||
let cleverMessage = message.content.replace(`<@${client.user.id}>`, "");
|
||||
console.log(`[Cleverbot] ${cleverMessage}`);
|
||||
message.channel.startTyping();
|
||||
cleverbot.write(cleverMessage, function(response) {
|
||||
message.reply(response.output);
|
||||
message.channel.stopTyping();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user