diff --git a/README.md b/README.md index 0177048b..2944bda1 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ don't grant that permission. ## Commands -Total: 370 +Total: 371 ### Utility: @@ -516,6 +516,7 @@ Total: 370 * **cleverbot:** Talk to Cleverbot. (Owner-Only) * **phone:** Starts a phone call with a random server. +* **phone-book:** Looks up phone-enabled servers. * **portal-send:** Send a message to a portal channel. * **prune:** Deletes up to 99 messages from the current channel. * **rename-all:** Renames every member of the server. (Owner-Only) diff --git a/commands/other/phone-book.js b/commands/other/phone-book.js new file mode 100644 index 00000000..5f19deb3 --- /dev/null +++ b/commands/other/phone-book.js @@ -0,0 +1,38 @@ +const Command = require('../../structures/Command'); +const { stripIndents } = require('common-tags'); + +module.exports = class PhoneBookCommand extends Command { + constructor(client) { + super(client, { + name: 'phone-book', + group: 'other', + memberName: 'phone-book', + description: 'Looks up phone-enabled servers.', + guildOnly: true, + args: [ + { + key: 'query', + prompt: 'What server 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.type === 'text' + && channel.topic + && channel.topic.includes('') + && !channel.topic.includes('') + && !msg.guild.channels.cache.has(channel.id) + && (channel.guild.name.includes(search) || channel.name.includes(search) || channel.id === search); + }); + if (!channels.size) return msg.reply('Could not find any results.'); + return msg.say(stripIndents` + _**Results:**__ _(${channels.size} Results)_ + ${channels.map(c => `**${c.id}** (#${c.name}: ${c.guild.name})`).slice(0, 10).join('\n')} + `) + } +}; diff --git a/commands/util/options.js b/commands/util/options.js index 8dfe0690..8b092b6e 100644 --- a/commands/util/options.js +++ b/commands/util/options.js @@ -20,6 +20,7 @@ module.exports = class OptionsCommand extends Command { \`\` Disables leave messages (System Channel). \`\` Allows this channel to recieve phone calls. + \`\` Hides this channel from \`phone-book\`. \`\` Marks the channel as a portal channel for \`portal-send\`. `); } diff --git a/package.json b/package.json index c9532c70..77367865 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "112.10.1", + "version": "112.11.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {