From 2ea7c09361a9d9b13b37b3106cafd57bc5b1c08c Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Sat, 17 Feb 2018 22:12:16 +0000 Subject: [PATCH] portal status --- commands/portal/portal-status.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 commands/portal/portal-status.js diff --git a/commands/portal/portal-status.js b/commands/portal/portal-status.js new file mode 100644 index 00000000..2ef8176a --- /dev/null +++ b/commands/portal/portal-status.js @@ -0,0 +1,22 @@ +const { Command } = require('discord.js-commando'); + +module.exports = class PortalStatusCommand extends Command { + constructor(client) { + super(client, { + name: 'portal-status', + group: 'portal', + memberName: 'portal-status', + description: 'Shows the number of currently opened portals.' + }); + } + + run(msg) { + const channels = this.client.provider.get('global', 'portals', []); + const local = msg.channel.type === 'text' ? channels.filter(c => !msg.guild.channels.has(c.id)).size : null; + return msg.say( + `There are currently **${channels.length}** open portals${msg.channel.type === 'text' + ? `, **${local}** of which are in this server.` + : '.'}` + ); + } +};