mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-20 14:00:22 +02:00
Make Code Prettier
This commit is contained in:
@@ -14,7 +14,7 @@ module.exports = class ClearSettingCommand extends Command {
|
||||
prompt: 'What setting do you want to clear? `modLog`, `memberLog`, or `staffRole`?',
|
||||
type: 'string',
|
||||
validate: setting => {
|
||||
if (['modLog', 'memberLog', 'staffRole'].includes(setting))
|
||||
if(['modLog', 'memberLog', 'staffRole'].includes(setting))
|
||||
return true;
|
||||
return 'Please enter either `modLog`, `memberLog`, or `staffRole`.';
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ module.exports = class HelpCommand extends Command {
|
||||
const { command } = args;
|
||||
const commands = this.client.registry.findCommands(command, false, msg);
|
||||
const showAll = command && command.toLowerCase() === 'all';
|
||||
if (command && !showAll) {
|
||||
if (commands.length === 1) {
|
||||
if(command && !showAll) {
|
||||
if(commands.length === 1) {
|
||||
return msg.say(stripIndents`
|
||||
__Command **${commands[0].name}**:__ *${commands[0].description}*
|
||||
${commands[0].guildOnly ? 'Usable Only in Servers' : 'Usable in Servers and DM'}
|
||||
@@ -38,17 +38,15 @@ module.exports = class HelpCommand extends Command {
|
||||
**Group:** ${commands[0].group.name}
|
||||
${commands[0].details || ''}
|
||||
`);
|
||||
} else if (commands.length > 1) {
|
||||
} else if(commands.length > 1) {
|
||||
return msg.say('Multiple Commands Found. Please be more specific.');
|
||||
} else {
|
||||
return msg.say(`Could not identify command. Use ${msg.usage(
|
||||
null, msg.channel.type === 'dm' ? null : undefined, msg.channel.type === 'dm' ? null : undefined
|
||||
)} to view a list of commands you can use.`);
|
||||
return msg.say(`Could not identify command. Use ${msg.usage(null)} to view a list of commands you can use.`);
|
||||
}
|
||||
} else {
|
||||
const embed = new RichEmbed()
|
||||
.setTitle(!showAll ? `Commands Available in ${msg.guild ? msg.guild.name : 'this DM'}` : 'All Commands')
|
||||
.setDescription(`Use ${this.usage('<command>', null, null)} to view detailed information about a specific command.`)
|
||||
.setDescription(`Use ${msg.usage('<command>')} to view detailed information about a specific command.`)
|
||||
.setColor(0x00AE86);
|
||||
for (const group of this.client.registry.groups.array()) {
|
||||
embed.addField(group.name,
|
||||
@@ -57,9 +55,9 @@ module.exports = class HelpCommand extends Command {
|
||||
group.commands.map(c => `\`${c.name}\``).join(', '));
|
||||
}
|
||||
try {
|
||||
await msg.author.send({embed});
|
||||
await msg.author.send({ embed });
|
||||
return msg.say(':mailbox_with_mail: Sent you a DM with information.');
|
||||
} catch (err) {
|
||||
} catch(err) {
|
||||
return msg.say('Failed to send DM. You probably have DMs disabled.');
|
||||
}
|
||||
}
|
||||
|
||||
+43
-5
@@ -1,5 +1,6 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { RichEmbed } = require('discord.js');
|
||||
const { oneLine } = require('common-tags');
|
||||
const { version } = require('../../package');
|
||||
const moment = require('moment');
|
||||
require('moment-duration-format');
|
||||
@@ -18,14 +19,18 @@ module.exports = class InfoCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
if(msg.channel.type !== 'dm')
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const guilds = await this.client.shard.fetchClientValues('guilds.size');
|
||||
const memory = await this.client.shard.broadcastEval('Math.round(process.memoryUsage().heapUsed / 1024 / 1024)');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x00AE86)
|
||||
.setFooter(`©2017 dragonfire535 | Version ${version} | Created ${moment.duration(Date.now() - this.client.user.createdTimestamp).format('y[ years], M[ months], w[ weeks, and ]d[ days]')} ago!`)
|
||||
.setFooter(oneLine`
|
||||
©2017 dragonfire535 |
|
||||
Version ${version} |
|
||||
Created ${moment.duration(Date.now() - this.client.user.createdTimestamp).format('y[ years], M[ months], w[ weeks, and ]d[ days]')} ago!
|
||||
`)
|
||||
.addField('Servers',
|
||||
`${this.client.guilds.size} / ${guilds.reduce((prev, val) => prev + val, 0)}`, true)
|
||||
.addField('Shards',
|
||||
@@ -45,9 +50,42 @@ module.exports = class InfoCommand extends Command {
|
||||
.addField('Library',
|
||||
'[discord.js](https://discord.js.org/#/)', true)
|
||||
.addField('Modules',
|
||||
'[commando](https://github.com/Gawdl3y/discord.js-commando), [zalgoize](https://github.com/clux/zalgolize), [superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/), [sequelize](http://docs.sequelizejs.com/en/v3/), [pg](https://github.com/brianc/node-postgres)')
|
||||
oneLine`
|
||||
[commando](https://github.com/Gawdl3y/discord.js-commando),
|
||||
[zalgoize](https://github.com/clux/zalgolize),
|
||||
[superagent](https://github.com/visionmedia/superagent),
|
||||
[mathjs](http://mathjs.org/),
|
||||
[moment](http://momentjs.com),
|
||||
[moment-duration-format](https://github.com/jsmreese/moment-duration-format),
|
||||
[jimp](https://github.com/oliver-moran/jimp),
|
||||
[cheerio](https://cheerio.js.org/),
|
||||
[sequelize](http://docs.sequelizejs.com/en/v3/),
|
||||
[pg](https://github.com/brianc/node-postgres)
|
||||
`
|
||||
)
|
||||
.addField('APIs',
|
||||
'[Wattpad](https://developer.wattpad.com/docs/api), [Wordnik](http://developer.wordnik.com/docs.html), [osu!](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices](http://docs.yugiohprices.apiary.io/#), [YouTube Data](https://developers.google.com/youtube/v3/), [Discord Bots](https://bots.discord.pw/api), [Today in History](http://history.muffinlabs.com/#api), [jService](http://jservice.io/), [Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB](http://www.omdbapi.com/), [Yahoo Weather](https://developer.yahoo.com/weather/), [Wikipedia](https://en.wikipedia.org/w/api.php), [Google Static Maps](https://developers.google.com/maps/documentation/static-maps/), [Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API), [rrrather](http://www.rrrather.com/botapi), [SoundCloud](https://developers.soundcloud.com/), [random.cat](http://random.cat/), [random.dog](https://random.dog/)');
|
||||
oneLine`
|
||||
[Wattpad](https://developer.wattpad.com/docs/api),
|
||||
[Wordnik](http://developer.wordnik.com/docs.html),
|
||||
[osu!](https://osu.ppy.sh/p/api),
|
||||
[memegen.link](https://memegen.link/),
|
||||
[Yugioh Prices](http://docs.yugiohprices.apiary.io/#),
|
||||
[YouTube Data](https://developers.google.com/youtube/v3/),
|
||||
[Discord Bots](https://bots.discord.pw/api),
|
||||
[Today in History](http://history.muffinlabs.com/#api),
|
||||
[jService](http://jservice.io/),
|
||||
[Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation),
|
||||
[OMDB](http://www.omdbapi.com/),
|
||||
[Yahoo Weather](https://developer.yahoo.com/weather/),
|
||||
[Wikipedia](https://en.wikipedia.org/w/api.php),
|
||||
[Google Static Maps](https://developers.google.com/maps/documentation/static-maps/),
|
||||
[Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API),
|
||||
[rrrather](http://www.rrrather.com/botapi),
|
||||
[SoundCloud](https://developers.soundcloud.com/),
|
||||
[random.cat](http://random.cat/),
|
||||
[random.dog](https://random.dog/)
|
||||
`
|
||||
);
|
||||
return msg.embed(embed);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -24,11 +24,11 @@ module.exports = class ShardInfoCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
if(msg.channel.type !== 'dm')
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { shard } = args;
|
||||
if (shard > this.client.options.shardCount - 1 || shard < 0)
|
||||
if(shard > this.client.options.shardCount - 1 || shard < 0)
|
||||
return msg.say('The Shard ID is not valid.');
|
||||
const memory = await this.client.shard.broadcastEval('Math.round(process.memoryUsage().heapUsed / 1024 / 1024)');
|
||||
const uptime = await this.client.shard.fetchClientValues('uptime');
|
||||
|
||||
Reference in New Issue
Block a user