From bb076a83056c835f39ea1952c7f2383dd48910b1 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Sun, 1 Mar 2020 22:07:39 -0500 Subject: [PATCH] Add ability to see phone and portal channel counts --- commands/other/phone.js | 3 +++ commands/other/portal-send.js | 10 +++++----- package.json | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/commands/other/phone.js b/commands/other/phone.js index 52add72e..899eedb8 100644 --- a/commands/other/phone.js +++ b/commands/other/phone.js @@ -31,6 +31,9 @@ module.exports = class PhoneCommand extends Command { && channel.topic && channel.topic.includes('') && !msg.guild.channels.cache.has(channel.id)); + if (message.toLowerCase() === 'count') { + return msg.say(`☎️ **${channels.size}** currently open lines.`); + } if (!channels.size) return msg.reply('No channels currently allow phone calls...'); const channel = channels.random(); try { diff --git a/commands/other/portal-send.js b/commands/other/portal-send.js index 09840b1b..b199cdc5 100644 --- a/commands/other/portal-send.js +++ b/commands/other/portal-send.js @@ -1,5 +1,4 @@ const Command = require('../../structures/Command'); -const { oneLine } = require('common-tags'); const { PORTAL_EMOJI_ID, PORTAL_EMOJI_NAME } = process.env; module.exports = class PortalSendCommand extends Command { @@ -29,13 +28,14 @@ module.exports = class PortalSendCommand extends Command { if (msg.channel.type === 'text') { channels = channels.filter(channel => !msg.guild.channels.cache.has(channel.id)); } + if (message.toLowerCase() === 'count') { + return msg.say(`**${this.portalEmoji} ${channels.size}** currently open portals.`); + } if (!channels.size) return msg.reply('No channels have an open portal...'); const channel = channels.random(); try { - await channel.send(oneLine` - **${this.portalEmoji} ${msg.author.tag} (${msg.channel.type === 'text' ? msg.guild.name : 'DM'}):** - ${message} - `); + const displayName = msg.channel.type === 'text' ? msg.guild.name : 'DM'; + await channel.send(`**${this.portalEmoji} ${msg.author.tag} (${displayName}):** ${message}`); return msg.say(`Message sent to **${channel.name}** in **${channel.guild.name}**!`); } catch (err) { return msg.reply('Failed to send the message. Try again later!'); diff --git a/package.json b/package.json index c4a5b387..3e34d7c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "111.1.4", + "version": "111.1.5", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {