mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Clean-ups
This commit is contained in:
+9
-1
@@ -109,7 +109,15 @@ client.on('guildDelete', async guild => {
|
||||
dBotsOrg(count, client.user.id);
|
||||
});
|
||||
|
||||
client.setTimeout(() => {
|
||||
const { wait } = require('./structures/Util');
|
||||
client.setTimeout(async () => {
|
||||
const battle = client.registry.resolveCommand('games:battle').fighting.size;
|
||||
const hangman = client.registry.resolveCommand('games:hangman').playing.size;
|
||||
const gunfight = client.registry.resolveCommand('games:gunfight').fighting.size;
|
||||
while (battle && hangman && gunfight) { // eslint-disable-line no-unmodified-loop-condition
|
||||
console.log('[RESTART] A game is going on, delaying...');
|
||||
await wait(5000);
|
||||
}
|
||||
console.log(`[RESTART] Shard ${client.shard.id} Restarted.`);
|
||||
process.exit(0);
|
||||
}, 7.2e+6);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"lastNames": [
|
||||
"last": [
|
||||
"Walker",
|
||||
"Tworni",
|
||||
"Ross",
|
||||
@@ -72,7 +72,7 @@
|
||||
"Galusha",
|
||||
"Alston"
|
||||
],
|
||||
"maleNames": [
|
||||
"male": [
|
||||
"Bob",
|
||||
"Daniel",
|
||||
"Logan",
|
||||
@@ -145,7 +145,7 @@
|
||||
"Larry",
|
||||
"Victor"
|
||||
],
|
||||
"femaleNames": [
|
||||
"female": [
|
||||
"Elizabeth",
|
||||
"Chelsey",
|
||||
"Rachel",
|
||||
|
||||
@@ -12,8 +12,7 @@ module.exports = class EmojiCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
const emoji = msg.guild.emojis;
|
||||
if (!emoji.size) return msg.say('You have no custom emoji.');
|
||||
return msg.say(emoji.map(e => e).join(''));
|
||||
if (!msg.guild.emojis.size) return msg.say('This server has no custom emoji.');
|
||||
return msg.say(msg.guild.emojis.map(e => e).join(''));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ module.exports = class CurrencyCommand extends Command {
|
||||
{
|
||||
key: 'amount',
|
||||
prompt: 'How much money should be converted? Do not use symbols.',
|
||||
type: 'integer'
|
||||
type: 'float'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ module.exports = class TemperatureCommand extends Command {
|
||||
{
|
||||
key: 'amount',
|
||||
prompt: 'What temperature should be converted?',
|
||||
type: 'integer'
|
||||
type: 'float'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -14,7 +14,6 @@ module.exports = class XiaoCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
const xiao = xiaos[Math.floor(Math.random() * xiaos.length)];
|
||||
return msg.say({ files: [xiao] });
|
||||
return msg.say({ files: [xiaos[Math.floor(Math.random() * xiaos.length)]] });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,10 +21,9 @@ module.exports = class MagicBallCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { question } = args;
|
||||
const answer = answers[Math.floor(Math.random() * answers.length)];
|
||||
return msg.say(stripIndents`
|
||||
Question: ${question}
|
||||
:8ball: ${answer} :8ball:
|
||||
:8ball: ${answers[Math.floor(Math.random() * answers.length)]} :8ball:
|
||||
`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,7 +20,6 @@ module.exports = class ChooseCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { choices } = args;
|
||||
const choice = choices[Math.floor(Math.random() * choices.length)];
|
||||
return msg.say(`I choose ${choice}!`);
|
||||
return msg.say(`I choose ${choices[Math.floor(Math.random() * choices.length)]}!`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,7 +13,6 @@ module.exports = class CoinFlipCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
const side = sides[Math.floor(Math.random() * sides.length)];
|
||||
return msg.say(`It landed on ${side}!`);
|
||||
return msg.say(`It landed on ${sides[Math.floor(Math.random() * sides.length)]}!`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,6 @@ module.exports = class ComplimentCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const user = args.user || msg.author;
|
||||
const compliment = compliments[Math.floor(Math.random() * compliments.length)];
|
||||
return msg.say(`${user.username}, ${compliment}`);
|
||||
return msg.say(`${user.username}, ${compliments[Math.floor(Math.random() * compliments.length)]}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,7 +12,6 @@ module.exports = class FactCoreCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
const fact = facts[Math.floor(Math.random() * facts.length)];
|
||||
return msg.say(fact);
|
||||
return msg.say(facts[Math.floor(Math.random() * facts.length)]);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,7 +13,6 @@ module.exports = class FortuneCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
const fortune = fortunes[Math.floor(Math.random() * fortunes.length)];
|
||||
return msg.say(fortune);
|
||||
return msg.say(fortunes[Math.floor(Math.random() * fortunes.length)]);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,10 +21,9 @@ module.exports = class MagicConchCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { question } = args;
|
||||
const answer = answers[Math.floor(Math.random() * answers.length)];
|
||||
return msg.say(stripIndents`
|
||||
Question: ${question}
|
||||
:shell: ${answer} :shell:
|
||||
:shell: ${answers[Math.floor(Math.random() * answers.length)]} :shell:
|
||||
`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { lastNames, maleNames, femaleNames } = require('../../assets/json/name');
|
||||
const { last, male, female } = require('../../assets/json/name');
|
||||
|
||||
module.exports = class RandomNameCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -26,23 +26,16 @@ module.exports = class RandomNameCommand extends Command {
|
||||
|
||||
run(msg, args) { // eslint-disable-line consistent-return
|
||||
const { gender } = args;
|
||||
const lastName = lastNames[Math.floor(Math.random() * lastNames.length)];
|
||||
const lastName = last[Math.floor(Math.random() * last.length)];
|
||||
if (gender === 'male') {
|
||||
const name = maleNames[Math.floor(Math.random() * maleNames.length)];
|
||||
return msg.say(`${name} ${lastName}`);
|
||||
return msg.say(`${male[Math.floor(Math.random() * male.length)]} ${lastName}`);
|
||||
} else if (gender === 'female') {
|
||||
const name = femaleNames[Math.floor(Math.random() * femaleNames.length)];
|
||||
return msg.say(`${name} ${lastName}`);
|
||||
return msg.say(`${female[Math.floor(Math.random() * female.length)]} ${lastName}`);
|
||||
} else if (gender === 'both') {
|
||||
const genders = ['male', 'female'];
|
||||
const randomGender = genders[Math.floor(Math.random() * genders.length)];
|
||||
if (randomGender === 'male') {
|
||||
const name = maleNames[Math.floor(Math.random() * maleNames.length)];
|
||||
return msg.say(`${name} ${lastName}`);
|
||||
} else if (randomGender === 'female') {
|
||||
const name = femaleNames[Math.floor(Math.random() * femaleNames.length)];
|
||||
return msg.say(`${name} ${lastName}`);
|
||||
}
|
||||
const rGender = genders[Math.floor(Math.random() * genders.length)];
|
||||
if (gender === 'male') return msg.say(`${male[Math.floor(Math.random() * male.length)]} ${lastName}`);
|
||||
else if (rGender === 'female') return msg.say(`${female[Math.floor(Math.random() * female.length)]} ${lastName}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,7 +12,6 @@ module.exports = class OffspringCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
const gender = genders[Math.floor(Math.random() * genders.length)];
|
||||
return msg.say(`It's a ${gender}!`);
|
||||
return msg.say(`It's a ${genders[Math.floor(Math.random() * genders.length)]}!`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,7 +13,6 @@ module.exports = class QuantumCoinCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
const side = sides[Math.floor(Math.random() * sides.length)];
|
||||
return msg.say(`It landed ${side}.`);
|
||||
return msg.say(`It landed ${sides[Math.floor(Math.random() * sides.length)]}.`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,7 +20,6 @@ module.exports = class RateWaifuCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { waifu } = args;
|
||||
const rating = Math.floor(Math.random() * 10) + 1;
|
||||
return msg.say(`I'd give ${waifu} a ${rating}/10!`);
|
||||
return msg.say(`I'd give ${waifu} a ${Math.floor(Math.random() * 10) + 1}/10!`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,6 @@ module.exports = class RoastCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const user = args.user || msg.author;
|
||||
const roast = roasts[Math.floor(Math.random() * roasts.length)];
|
||||
return msg.say(`${user.username}, ${roast}`);
|
||||
return msg.say(`${user.username}, ${roasts[Math.floor(Math.random() * roasts.length)]}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,7 +22,6 @@ module.exports = class RollCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { value } = args;
|
||||
const roll = Math.floor(Math.random() * value) + 1;
|
||||
return msg.say(`You rolled a ${roll}.`);
|
||||
return msg.say(`You rolled a ${Math.floor(Math.random() * value) + 1}.`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,8 +20,7 @@ module.exports = class ShipCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { things } = args;
|
||||
const rating = Math.floor(Math.random() * 100) + 1;
|
||||
const list = `${things.slice(0, -1).join(', ')}${things.length > 1 ? ' and ' : ''}${things.slice(-1)}`;
|
||||
return msg.say(`I'd give ${list} a ${rating}%!`);
|
||||
return msg.say(`I'd give ${list} a ${Math.floor(Math.random() * 100) + 1}%!`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@ module.exports = class BulbapediaCommand extends Command {
|
||||
.setColor(0x3E7614)
|
||||
.setTitle(body.query.pages[0].title)
|
||||
.setAuthor('Bulbapedia', 'https://i.imgur.com/09eYo5T.png')
|
||||
.setDescription(body.query.pages[0].extract.replace(/[\n]/g, '\n\n').substr(0, 2048));
|
||||
.setDescription(body.query.pages[0].extract.replace(/\n/g, '\n\n').substr(0, 2048));
|
||||
return msg.embed(embed);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -29,7 +29,6 @@ module.exports = class GiphyCommand extends Command {
|
||||
rating: msg.channel.nsfw ? 'r' : 'pg'
|
||||
});
|
||||
if (!body.data.length) return msg.say('No Results.');
|
||||
const random = Math.floor(Math.random() * body.data.length);
|
||||
return msg.say(body.data[random].images.original.url);
|
||||
return msg.say(body.data[Math.floor(Math.random() * body.data.length)].images.original.url);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -29,16 +29,13 @@ module.exports = class PokedexCommand extends Command {
|
||||
const { body } = await snekfetch
|
||||
.get(`https://pokeapi.co/api/v2/pokemon-species/${pokemon}`);
|
||||
const id = `${'000'.slice(body.id.toString().length)}${body.id}`;
|
||||
const name = this.filter(body.names).name;
|
||||
const flavor = this.filter(body.flavor_text_entries).flavor_text.replace(/(\n|\f|\r)/g, ' ');
|
||||
const species = this.filter(body.genera).genus;
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0xED1C24)
|
||||
.setAuthor(`#${id} - ${name}`, `https://www.serebii.net/pokedex-sm/icon/${id}.png`)
|
||||
.setAuthor(`#${id} - ${this.filter(body.names).name}`, `https://www.serebii.net/pokedex-sm/icon/${id}.png`)
|
||||
.setURL(`https://www.serebii.net/pokedex-sm/${id}.shtml`)
|
||||
.setDescription(stripIndents`
|
||||
**The ${species} Pokémon**
|
||||
${flavor}
|
||||
**The ${this.filter(body.genera).genus} Pokémon**
|
||||
${this.filter(body.flavor_text_entries).flavor_text.replace(/(\n|\f|\r)/g, ' ')}
|
||||
`)
|
||||
.setThumbnail(`https://www.serebii.net/sunmoon/pokemon/${id}.png`);
|
||||
return msg.embed(embed);
|
||||
|
||||
@@ -26,21 +26,22 @@ module.exports = class RedditCommand extends Command {
|
||||
const { body } = await snekfetch
|
||||
.get(`https://www.reddit.com/r/${subreddit}/new.json`)
|
||||
.query({ sort: 'new' });
|
||||
const post = body.data.children[Math.floor(Math.random() * body.data.children.length)].data;
|
||||
if (!msg.channel.nsfw && post.over_18) return msg.say('This post is only viewable in NSFW Channels.');
|
||||
const post = body.data.children[Math.floor(Math.random() * body.data.children.length)];
|
||||
if (!post.data) return msg.say('This post has no data, try again!');
|
||||
if (!msg.channel.nsfw && post.data.over_18) return msg.say('This post is only viewable in NSFW Channels.');
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0xFF4500)
|
||||
.setAuthor('Reddit', 'https://i.imgur.com/V6hXniU.png')
|
||||
.setURL(`https://www.reddit.com${post.permalink}`)
|
||||
.setTitle(post.title)
|
||||
.setDescription(`[View URL Here](${post.url})`)
|
||||
.setThumbnail(post.thumbnail !== 'self' ? post.thumbnail : null)
|
||||
.setURL(`https://www.reddit.com${post.data.permalink}`)
|
||||
.setTitle(post.data.title)
|
||||
.setDescription(`[View URL Here](${post.data.url})`)
|
||||
.setThumbnail(post.data.thumbnail !== 'self' ? post.data.thumbnail : null)
|
||||
.addField('❯ Upvotes',
|
||||
post.ups, true)
|
||||
post.data.ups, true)
|
||||
.addField('❯ Downvotes',
|
||||
post.downs, true)
|
||||
post.data.downs, true)
|
||||
.addField('❯ Score',
|
||||
post.score, true);
|
||||
post.data.score, true);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
if (err.status === 404) return msg.say('Subreddit Not Found.');
|
||||
|
||||
@@ -36,10 +36,9 @@ module.exports = class WikiaCommand extends Command {
|
||||
limit: 1,
|
||||
namespaces: 0
|
||||
});
|
||||
const id = search.body.items[0].id;
|
||||
const { body } = await snekfetch
|
||||
.get(`http://${wiki}.wikia.com/api/v1/Articles/AsSimpleJson/`)
|
||||
.query({ id });
|
||||
.query({ id: search.body.items[0].id });
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0x002D54)
|
||||
.setTitle(body.sections[0].title)
|
||||
|
||||
@@ -39,7 +39,7 @@ module.exports = class WikipediaCommand extends Command {
|
||||
.setColor(0xE7E7E7)
|
||||
.setTitle(body.query.pages[0].title)
|
||||
.setAuthor('Wikipedia', 'https://i.imgur.com/a4eeEhh.png')
|
||||
.setDescription(body.query.pages[0].extract.replace(/[\n]/g, '\n\n').substr(0, 2048));
|
||||
.setDescription(body.query.pages[0].extract.replace(/\n/g, '\n\n').substr(0, 2048));
|
||||
return msg.embed(embed);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -23,8 +23,7 @@ module.exports = class BinaryCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = this.binary(text);
|
||||
return msg.say(converted);
|
||||
return msg.say(this.binary(text));
|
||||
}
|
||||
|
||||
binary(text) {
|
||||
|
||||
@@ -27,7 +27,7 @@ module.exports = class MockingCommand extends Command {
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
for (let i = 0; i < text.length; i += Math.floor(Math.random() * 4)) text[i] = text[i].toUpperCase();
|
||||
return msg.say(`\u180E${text.join('')} <:sponge:318612443398144000>`);
|
||||
return msg.say(`${text.join('')} <:sponge:318612443398144000>`);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = class MorseCommand extends Command {
|
||||
prompt: 'What text would you like to convert to morse?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (letterTrans(text, dictionary, ' ').length < 1999) return true;
|
||||
if (letterTrans(text, dictionary, ' ').length < 2000) return true;
|
||||
return 'Your text is too long.';
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@ module.exports = class MorseCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = letterTrans(text.toLowerCase(), dictionary, ' ');
|
||||
return msg.say(converted);
|
||||
return msg.say(letterTrans(text.toLowerCase(), dictionary, ' '));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -23,8 +23,8 @@ module.exports = class OrganizationXIIINameCommand extends Command {
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
text.push('x');
|
||||
const converted = shuffle(text);
|
||||
converted[0] = converted[0].toUpperCase();
|
||||
return msg.say(`\u180E${converted.join('')}`);
|
||||
const shuffled = shuffle(text);
|
||||
shuffled[0] = shuffled[0].toUpperCase();
|
||||
return msg.say(shuffled.join(''));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = class PirateCommand extends Command {
|
||||
prompt: 'What text would you like to convert to pirate?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (wordTrans(text, dictionary).length < 1999) return true;
|
||||
if (wordTrans(text, dictionary).length < 2000) return true;
|
||||
return 'Your text is too long.';
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@ module.exports = class PirateCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = wordTrans(text, dictionary);
|
||||
return msg.say(`\u180E${converted}`);
|
||||
return msg.say(wordTrans(text, dictionary));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,7 +11,11 @@ module.exports = class RepeatCommand extends Command {
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to repeat over and over and over and over?',
|
||||
type: 'string'
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (!text.includes('@everyone') && !text.includes('@here')) return true;
|
||||
return 'Please do not repeat everyone or here mentions.';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
@@ -19,7 +23,6 @@ module.exports = class RepeatCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = text.repeat(2000).substr(0, 1999);
|
||||
return msg.say(`\u180E${converted}`);
|
||||
return msg.say(text.repeat(2000).substr(0, 2000));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,7 +19,6 @@ module.exports = class ReverseCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = text.split('').reverse().join('');
|
||||
return msg.say(`\u180E${converted}`);
|
||||
return msg.say(text.split('').reverse().join(''));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -9,7 +9,6 @@ module.exports = class SayCommand extends Command {
|
||||
memberName: 'say',
|
||||
description: 'Make XiaoBot say what you wish.',
|
||||
guildOnly: true,
|
||||
clientPermissions: ['MANAGE_MESSAGES'],
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
@@ -22,7 +21,7 @@ module.exports = class SayCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
msg.delete();
|
||||
return msg.say(`\u180E${text}`);
|
||||
if (msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES')) msg.delete();
|
||||
return msg.say(text);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -20,7 +20,6 @@ module.exports = class ShuffleCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = shuffle(text.split('')).join('');
|
||||
return msg.say(`\u180E${converted}`);
|
||||
return msg.say(shuffle(text.split('')).join(''));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = class TemmieCommand extends Command {
|
||||
prompt: 'What text would you like to convert to Temmie speak?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if (wordTrans(text, dictionary).length < 1999) return true;
|
||||
if (wordTrans(text, dictionary).length < 2000) return true;
|
||||
return 'Your text is too long.';
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,6 @@ module.exports = class TemmieCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = wordTrans(text, dictionary);
|
||||
return msg.say(`\u180E${converted}`);
|
||||
return msg.say(wordTrans(text, dictionary));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,7 +22,6 @@ module.exports = class UpsideDownCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = letterTrans(text, dictionary);
|
||||
return msg.say(converted);
|
||||
return msg.say(letterTrans(text, dictionary));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -24,7 +24,6 @@ module.exports = class ZalgoCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { text } = args;
|
||||
const converted = zalgo(text);
|
||||
return msg.say(`\u180E${converted}`);
|
||||
return msg.say(zalgo(text));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -26,7 +26,6 @@ module.exports = class UserInfoCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const member = args.member || msg.member;
|
||||
const status = member.user.presence.status;
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(member.displayHexColor)
|
||||
.setThumbnail(member.user.displayAvatarURL())
|
||||
@@ -39,7 +38,7 @@ module.exports = class UserInfoCommand extends Command {
|
||||
.addField('❯ Server Join Date',
|
||||
moment(member.joinedTimestamp).format('MMMM Do YYYY'), true)
|
||||
.addField('❯ Status',
|
||||
statuses[status], true)
|
||||
statuses[member.user.presence.status], true)
|
||||
.addField('❯ Playing',
|
||||
member.user.presence.game ? member.user.presence.game.name : 'N/A', true)
|
||||
.addField('❯ Highest Role',
|
||||
|
||||
@@ -40,7 +40,7 @@ module.exports = class InfoCommand extends Command {
|
||||
.addField('❯ Node Version',
|
||||
process.version, true)
|
||||
.addField('❯ Library',
|
||||
'[discord.js](https://discord.js.org)[-commando](https://github.com/Gawdl3y/discord.js-commando)', true); // eslint-disable-line max-len
|
||||
'[discord.js](https://discord.js.org)[-commando](https://github.com/Gawdl3y/discord.js-commando)', true);
|
||||
return msg.embed(embed);
|
||||
}
|
||||
};
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "30.3.0",
|
||||
"version": "30.3.2",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Shard.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -16,24 +16,20 @@ class XiaoCommand extends Command {
|
||||
}
|
||||
|
||||
hasPermission(msg) {
|
||||
if (this.ownerOnly && !this.client.isOwner(msg.author)) {
|
||||
return 'This Command can only be used by the bot owner.';
|
||||
}
|
||||
if (this.nsfw && !msg.channel.nsfw) {
|
||||
return 'This Command can only be used in NSFW Channels.';
|
||||
}
|
||||
if (msg.channel.type !== 'dm') {
|
||||
if (this.ownerOnly && !this.client.isOwner(msg.author)) return 'This Command can only be used by the bot owner.';
|
||||
if (this.nsfw && !msg.channel.nsfw) return 'This Command can only be used in NSFW Channels.';
|
||||
if (msg.channel.type === 'text') {
|
||||
if (this.clientPermissions) {
|
||||
for (const permission of this.clientPermissions) {
|
||||
if (!msg.channel.permissionsFor(this.client.user).has(permission)) {
|
||||
return `This Command requires the \`${perms[permission]}\` Permission.`;
|
||||
return `This Command requires me to have the \`${perms[permission]}\` Permission.`;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.userPermissions) {
|
||||
for (const permission of this.userPermissions) {
|
||||
if (!msg.channel.permissionsFor(msg.author).has(permission)) {
|
||||
return `You do not have the \`${perms[permission]}\` Permission.`;
|
||||
return `This Command requires you to have the \`${perms[permission]}\` Permission.`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-13
@@ -5,11 +5,11 @@ const { CARBON_KEY, DBOTS_KEY, DBOTSORG_KEY } = process.env;
|
||||
class Util {
|
||||
static cleanXML(str) {
|
||||
return str
|
||||
.replace(/(<br \/>)/g, '')
|
||||
.replace(/(')/g, '\'')
|
||||
.replace(/(—)/g, '—')
|
||||
.replace(/<br \/>/g, '')
|
||||
.replace(/'/g, '\'')
|
||||
.replace(/—/g, '—')
|
||||
.replace(/("|")/g, '"')
|
||||
.replace(/(&)/g, '&')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/(\[i\]|\[\/i\])/g, '*');
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ class Util {
|
||||
|
||||
static filterTopics(channels, setting) {
|
||||
return channels.filter(c => {
|
||||
if (c.type !== 'text' || !c.topic) return false;
|
||||
if (c.topic.includes(`<${setting}>`) && c.permissionsFor(c.client.user).has('SEND_MESSAGES')) return true;
|
||||
if (c.type !== 'text' || !c.topic || !c.permissionsFor(c.client.user).has('SEND_MESSAGES')) return false;
|
||||
if (c.topic.includes(`<${setting}>`)) return true;
|
||||
return false;
|
||||
});
|
||||
}
|
||||
@@ -63,13 +63,13 @@ class Util {
|
||||
}
|
||||
|
||||
static shuffle(arr) {
|
||||
for (let i = arr.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
const temp = arr[i];
|
||||
arr[i] = arr[j];
|
||||
arr[j] = temp;
|
||||
}
|
||||
return arr;
|
||||
for (let i = arr.length - 1; i > 0; i--) {
|
||||
const j = Math.floor(Math.random() * (i + 1));
|
||||
const temp = arr[i];
|
||||
arr[i] = arr[j];
|
||||
arr[j] = temp;
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user