Code Improvements

This commit is contained in:
Daniel Odendahl Jr
2017-04-17 21:57:35 +00:00
parent 45ba18bea9
commit 9dd0589de5
46 changed files with 73 additions and 209 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ module.exports = class InfoCommand extends Command {
});
}
async run(message, args) {
async run(message) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
@@ -33,7 +33,7 @@ module.exports = class InfoCommand extends Command {
.addField('Shards',
`${this.client.options.shardCount} (${this.client.shard.id})`, true)
.addField('Commands',
'108', true)
'106', true)
.addField('Owner',
'dragonfire535#8081', true)
.addField('Source Code',
-29
View File
@@ -1,29 +0,0 @@
const { Command } = require('discord.js-commando');
module.exports = class ServersCommand extends Command {
constructor(client) {
super(client, {
name: 'servers',
aliases: [
'serverlist'
],
group: 'util',
memberName: 'servers',
description: 'Sends a list of all server names and IDs to the log. (;servers)',
examples: [';servers']
});
}
hasPermission(msg) {
return this.client.isOwner(msg.author);
}
run(message) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
const guildCount = this.client.guilds.size;
const guildNames = this.client.guilds.map(g => `${g.name} (${g.id})`).join(', ');
console.log(`${guildCount} Servers: ${guildNames}`);
return message.say('Sent the information to the console!');
}
};
+1 -3
View File
@@ -32,9 +32,7 @@ module.exports = class ShardInfoCommand extends Command {
if (!message.channel.permissionsFor(this.client.user).hasPermission('EMBED_LINKS')) return message.say(':x: Error! I don\'t have the Embed Links Permission!');
}
const shardID = args.shardID;
if (shardID > this.client.options.shardCount - 1 || shardID < 0) {
return message.say(':x: Error! Invalid Shard!');
}
if (shardID > this.client.options.shardCount - 1 || shardID < 0) return message.say(':x: Error! Invalid Shard!');
const memory = await this.client.shard.broadcastEval('Math.round(process.memoryUsage().heapUsed / 1024 / 1024)');
const uptime = await this.client.shard.fetchClientValues('uptime');
const guilds = await this.client.shard.fetchClientValues('guilds.size');