From af6932d6b249dcea1805a6d7563a58447374b50c Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Thu, 19 Mar 2020 12:53:53 -0400 Subject: [PATCH] Allow getting phone count even in non-marked channels --- commands/other/phone.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/commands/other/phone.js b/commands/other/phone.js index 00649b27..d44e7cce 100644 --- a/commands/other/phone.js +++ b/commands/other/phone.js @@ -19,7 +19,8 @@ module.exports = class PhoneCommand extends Command { validate: channelID => { if (channelID.toLowerCase() === 'count') return true; return /^[0-9]+$/.test(channelID); - } + }, + parse: channelID => channelID.toLowerCase() } ], credit: [ @@ -33,10 +34,11 @@ module.exports = class PhoneCommand extends Command { } async run(msg, { channelID }) { - if (!msg.channel.topic || !msg.channel.topic.includes('')) { + if (channelID !== 'count' && !msg.channel.topic || !msg.channel.topic.includes('')) { return msg.say('You can only start a call in a channel with `` in the topic.'); } - if (this.client.phone.some(call => [call.origin.id, call.recipient.id].includes(msg.channel.id))) { + const inCall = this.client.phone.some(call => [call.origin.id, call.recipient.id].includes(msg.channel.id)); + if (channelID !== 'count' && inCall) { return msg.say('This channel is already in a phone call.'); } const channels = this.client.channels.cache.filter(channel => channel.type === 'text' @@ -46,7 +48,7 @@ module.exports = class PhoneCommand extends Command { if (!channels.size) return msg.reply('No channels currently allow phone calls...'); let channel; if (channelID) { - if (channelID.toLowerCase() === 'count') return msg.say(`☎️ **${channels.size}** currently open lines.`); + if (channelID === 'count') return msg.say(`☎️ **${channels.size}** currently open lines.`); channel = this.client.channels.cache.get(channelID); if (!channel || channel.type !== 'text') return msg.reply('This channel does not exist.'); if (!channel.topic || !channel.topic.includes('')) {