Disallow new calls in channels that already have one

This commit is contained in:
Dragon Fire
2020-02-28 15:50:45 -05:00
parent b7b0c957b7
commit bc62bec1d7
+3
View File
@@ -17,6 +17,9 @@ module.exports = class PhoneCommand extends Command {
if (!msg.channel.topic || !msg.channel.topic.includes('<xiao:phone>')) {
return msg.say('You can only start a call in a channel with `<xiao:phone>` in the topic.');
}
if (this.client.phone.some(call => [call.origin.id, call.recipient.id].includes(msg.channel.id))) {
return msg.say('This channel is already in a phone call.');
}
const channels = this.client.channels.cache.filter(channel => channel.type === 'text'
&& channel.topic
&& channel.topic.includes('<xiao:phone>')