diff --git a/commands/botinfo/info.js b/commands/botinfo/info.js index 9f7838a9..be43baaa 100644 --- a/commands/botinfo/info.js +++ b/commands/botinfo/info.js @@ -14,13 +14,8 @@ module.exports = class InfoCommand extends Command { ], group: 'botinfo', memberName: 'info', - description: 'Gives some bot info. (;info)', - examples: [';info'], - args: [{ - key: 'shardID', - prompt: 'Which Shard would you like to get data for? You can find your shard with `;server`.', - type: 'integer' - }] + description: 'Gives some bot info for your shard. (;info)', + examples: [';info'] }); } @@ -29,30 +24,24 @@ module.exports = class InfoCommand extends Command { 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!'); } - const shardID = args.shardID; - 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'); 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!`) .addField('Servers', - `${guilds[shardID]} / ${guilds.reduce((prev, val) => prev + val, 0)}`, true) + `${this.client.guilds.size} / ${guilds.reduce((prev, val) => prev + val, 0)}`, true) .addField('Shards', - `${this.client.options.shardCount} (${shardID})`, true) + `${this.client.options.shardCount} (${this.client.shard.id})`, true) .addField('Commands', - '113', true) + '114', true) .addField('Owner', 'dragonfire535#8081', true) .addField('Source Code', '[View Here](https://github.com/dragonfire535/xiaobot)', true) .addField('Memory Usage', - `${memory[shardID]}MB`, true) + `${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)}MB`, true) .addField('Uptime', - moment.duration(uptime[shardID]).format('d[d]h[h]m[m]s[s]'), true) + moment.duration(this.client.uptime).format('d[d]h[h]m[m]s[s]'), true) .addField('Node Version', process.version, true) .addField('Library', diff --git a/commands/botinfo/shardinfo.js b/commands/botinfo/shardinfo.js new file mode 100644 index 00000000..d0c8fe80 --- /dev/null +++ b/commands/botinfo/shardinfo.js @@ -0,0 +1,57 @@ +const { Command } = require('discord.js-commando'); +const { RichEmbed } = require('discord.js'); +const { version } = require('../../package.json'); +const moment = require('moment'); +require('moment-duration-format'); + +module.exports = class ShardInfoCommand extends Command { + constructor(client) { + super(client, { + name: 'shardinfo', + aliases: [ + 'shard-info', + 'shard-data', + 'sharddata' + ], + group: 'botinfo', + memberName: 'shardinfo', + description: 'Gives some bot info for the Shard you specify. (;info 0)', + examples: [';info 0'], + args: [{ + key: 'shardID', + prompt: 'Which Shard would you like to get data for?', + type: 'integer' + }] + }); + } + + async run(message, args) { + 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!'); + } + const shardID = args.shardID; + 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'); + 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!`) + .addField('Servers', + `${guilds[shardID]} / ${guilds.reduce((prev, val) => prev + val, 0)}`, true) + .addField('Shards', + `${this.client.options.shardCount} (${shardID})`, true) + .addField('Commands', + '114', true) + .addField('Memory Usage', + `${memory[shardID]}MB`, true) + .addField('Uptime', + moment.duration(uptime[shardID]).format('d[d]h[h]m[m]s[s]'), true) + .addField('Node Version', + process.version, true); + return message.embed(embed); + } +}; diff --git a/html/carbondesc.html b/html/carbondesc.html index 3291a2b5..639ef163 100644 --- a/html/carbondesc.html +++ b/html/carbondesc.html @@ -53,7 +53,7 @@

Information

diff --git a/html/discordbots.html b/html/discordbots.html index d28c3c97..1324c002 100644 --- a/html/discordbots.html +++ b/html/discordbots.html @@ -102,7 +102,7 @@

Information

diff --git a/package.json b/package.json index 98a6f63c..90537665 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "22.0.1", + "version": "22.1.0", "description": "A Discord Bot", "main": "shardingmanager.js", "repository": {