mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-13 00:09:08 +02:00
Add blocking of users fully from phone
This commit is contained in:
@@ -25,6 +25,18 @@ module.exports = class PhoneBlockCommand extends Command {
|
||||
const search = query.toLowerCase();
|
||||
return channel.guild && (channel.name.includes(search) || channel.id === search);
|
||||
});
|
||||
let user;
|
||||
try {
|
||||
user = await this.client.users.fetch(query);
|
||||
} catch {
|
||||
user = null;
|
||||
}
|
||||
if (user) {
|
||||
return msg.say(stripIndents`
|
||||
__To block **${user.tag} (${user.id})** from DM calling and messages:__
|
||||
Place \`<xiao:phone:block:${user.id}>\` in this channel's topic
|
||||
`);
|
||||
}
|
||||
if (!channels.size) return msg.reply('Could not find any results.');
|
||||
if (channels.size > 1) return msg.reply(`Found ${channels.size} channels, please be more specific (or use ID).`);
|
||||
const channel = channels.first();
|
||||
|
||||
@@ -47,10 +47,7 @@ module.exports = class PhoneCommand extends Command {
|
||||
&& channel.topic
|
||||
&& channel.topic.includes('<xiao:phone>')
|
||||
&& !channel.topic.includes('<xiao:phone:no-random>')
|
||||
&& !channel.topic.includes(`<xiao:phone:block:${msg.guild ? msg.channel.id : msg.author.id}>`)
|
||||
&& (msg.guild ? !channel.topic.includes(`<xiao:phone:block:${msg.guild.id}>`) : true)
|
||||
&& (msg.guild ? msg.channel.topic && !msg.channel.topic.includes(`<xiao:phone:block:${channel.id}>`) : true)
|
||||
&& (msg.guild ? msg.channel.topic && !msg.channel.topic.includes(`<xiao:phone:block:${channel.guild.id}>`) : true)
|
||||
&& !this.client.phone.isBlockedFromPhone(msg.channel, channel, msg.author)
|
||||
&& (msg.guild ? !msg.guild.channels.cache.has(channel.id) : true)
|
||||
&& (channelID ? true : !this.client.inPhoneCall(channel)));
|
||||
if (!channels.size) return msg.reply('No channels currently allow phone calls...');
|
||||
@@ -65,12 +62,9 @@ module.exports = class PhoneCommand extends Command {
|
||||
return msg.reply('This channel does not allow phone calls.');
|
||||
}
|
||||
if (this.client.inPhoneCall(channel)) return msg.reply('This channel is already in a call.');
|
||||
if (channel.topic.includes(`<xiao:phone:block:${msg.channel.id}>`)) {
|
||||
if (this.client.isBlockedFromPhone(msg.channel, channel, msg.author)) {
|
||||
return msg.reply('That channel has blocked this channel from calling them.');
|
||||
}
|
||||
if (msg.guild && channel.topic.includes(`<xiao:phone:block:${msg.guild.id}>`)) {
|
||||
return msg.reply('That channel has blocked this server from calling them.');
|
||||
}
|
||||
} else {
|
||||
channel = channels.random();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user