From 59b661ec2ded2f02334a1a788ed5ace526ec1272 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Thu, 3 Sep 2020 16:05:14 -0400 Subject: [PATCH] Phone Block Command --- README.md | 3 ++- commands/phone/phone-block.js | 38 +++++++++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 commands/phone/phone-block.js diff --git a/README.md b/README.md index 76abc039..c89e57eb 100644 --- a/README.md +++ b/README.md @@ -255,7 +255,7 @@ in the appropriate channel's topic to use it. ## Commands -Total: 539 +Total: 540 ### Utility: @@ -820,6 +820,7 @@ Total: 539 * **admin-phone:** Starts an admin phone call with a server. (Owner-Only) * **hang-up:** Hangs up the current phone call. +* **phone-block:** Gives instructions for blocking a channel or server. * **phone-book:** Looks up phone-enabled servers. * **phone-info:** Gives information on the current phone call. * **phone:** Starts a phone call with a random server. diff --git a/commands/phone/phone-block.js b/commands/phone/phone-block.js new file mode 100644 index 00000000..4b5e9afe --- /dev/null +++ b/commands/phone/phone-block.js @@ -0,0 +1,38 @@ +const Command = require('../../structures/Command'); +const { stripIndents } = require('common-tags'); + +module.exports = class PhoneBlockCommand extends Command { + constructor(client) { + super(client, { + name: 'phone-block', + aliases: ['call-block'], + group: 'phone', + memberName: 'phone-block', + description: 'Gives instructions for blocking a channel or server.', + guildOnly: true, + args: [ + { + key: 'query', + prompt: 'What channel would you like to search for?', + type: 'string' + } + ] + }); + } + + run(msg, { query }) { + const channels = this.client.channels.cache.filter(channel => { + const search = query.toLowerCase(); + return channel.guild + && (channel.guild.name.toLowerCase().includes(search) || channel.name.includes(search) || channel.id === search); + }); + 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(); + return msg.say(stripIndents` + __To block **#${channel.name} (${channel.id})**:__ + Just the channel: Place \`\` in this channel's topic + The entire server: Place \`\` in this channel's topic + `); + } +}; diff --git a/package.json b/package.json index 7480b2ba..6c674b29 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "119.22.0", + "version": "119.23.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {