mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-27 06:37:32 +02:00
Split Phone into it's own manager
This commit is contained in:
@@ -23,7 +23,7 @@ module.exports = class AdminPhoneCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, { channelID }) {
|
||||
if (this.client.inPhoneCall(msg.channel)) return msg.say('This channel is already in a phone call.');
|
||||
if (this.client.phone.inCall(msg.channel)) return msg.say('This channel is already in a phone call.');
|
||||
const channel = this.client.channels.cache.get(channelID);
|
||||
if (!channel || !channel.guild) return msg.reply('This channel does not exist.');
|
||||
try {
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = class HangUpCommand extends Command {
|
||||
return msg.reply('☎️ You cannot hang up in an admin call.');
|
||||
}
|
||||
const otherChannel = call.origin.id === msg.channel.id ? call.recipient : call.origin;
|
||||
if (this.client.isBlockedFromPhone(msg.channel, otherChannel, msg.author)) {
|
||||
if (this.client.phone.isBlocked(msg.channel, otherChannel, msg.author)) {
|
||||
return msg.reply('☎️ You are blocked from hanging up this phone call.');
|
||||
}
|
||||
const nonQuitter = msg.channel.id === call.origin.id ? call.recipient : call.origin;
|
||||
|
||||
@@ -40,16 +40,16 @@ module.exports = class PhoneCommand extends Command {
|
||||
if (channelID !== 'count' && (msg.guild && (!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 (channelID !== 'count' && this.client.inPhoneCall(msg.channel)) {
|
||||
if (channelID !== 'count' && this.client.phone.inCall(msg.channel)) {
|
||||
return msg.say('This channel is already in a phone call.');
|
||||
}
|
||||
const channels = this.client.channels.cache.filter(channel => channel.guild
|
||||
&& channel.topic
|
||||
&& channel.topic.includes('<xiao:phone>')
|
||||
&& !channel.topic.includes('<xiao:phone:no-random>')
|
||||
&& !this.client.isBlockedFromPhone(msg.channel, channel, msg.author)
|
||||
&& !this.client.phone.isBlocked(msg.channel, channel, msg.author)
|
||||
&& (msg.guild ? !msg.guild.channels.cache.has(channel.id) : true)
|
||||
&& (channelID ? true : !this.client.inPhoneCall(channel)));
|
||||
&& (channelID ? true : !this.client.phone.inCall(channel)));
|
||||
if (!channels.size) return msg.reply('No channels currently allow phone calls...');
|
||||
let channel;
|
||||
if (channelID) {
|
||||
@@ -61,8 +61,8 @@ module.exports = class PhoneCommand extends Command {
|
||||
if (!channel.topic || !channel.topic.includes('<xiao:phone>')) {
|
||||
return msg.reply('That channel does not allow phone calls.');
|
||||
}
|
||||
if (this.client.inPhoneCall(channel)) return msg.reply('That channel is already in a call.');
|
||||
if (this.client.isBlockedFromPhone(msg.channel, channel, msg.author)) {
|
||||
if (this.client.phone.inCall(channel)) return msg.reply('That channel is already in a call.');
|
||||
if (this.client.phone.isBlocked(msg.channel, channel, msg.author)) {
|
||||
return msg.reply('That channel has blocked this channel from calling them.');
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user