mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-14 00:08:06 +02:00
Phone Book Command
This commit is contained in:
@@ -118,7 +118,7 @@ don't grant that permission.
|
|||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
Total: 370
|
Total: 371
|
||||||
|
|
||||||
### Utility:
|
### Utility:
|
||||||
|
|
||||||
@@ -516,6 +516,7 @@ Total: 370
|
|||||||
|
|
||||||
* **cleverbot:** Talk to Cleverbot. (Owner-Only)
|
* **cleverbot:** Talk to Cleverbot. (Owner-Only)
|
||||||
* **phone:** Starts a phone call with a random server.
|
* **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.
|
* **portal-send:** Send a message to a portal channel.
|
||||||
* **prune:** Deletes up to 99 messages from the current channel.
|
* **prune:** Deletes up to 99 messages from the current channel.
|
||||||
* **rename-all:** Renames every member of the server. (Owner-Only)
|
* **rename-all:** Renames every member of the server. (Owner-Only)
|
||||||
|
|||||||
@@ -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('<xiao:phone>')
|
||||||
|
&& !channel.topic.includes('<xiao:phone-book:hide>')
|
||||||
|
&& !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')}
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -20,6 +20,7 @@ module.exports = class OptionsCommand extends Command {
|
|||||||
|
|
||||||
\`<xiao:disable-leave>\` Disables leave messages (System Channel).
|
\`<xiao:disable-leave>\` Disables leave messages (System Channel).
|
||||||
\`<xiao:phone>\` Allows this channel to recieve phone calls.
|
\`<xiao:phone>\` Allows this channel to recieve phone calls.
|
||||||
|
\`<xiao:phone-book:hide>\` Hides this channel from \`phone-book\`.
|
||||||
\`<xiao:portal>\` Marks the channel as a portal channel for \`portal-send\`.
|
\`<xiao:portal>\` Marks the channel as a portal channel for \`portal-send\`.
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "112.10.1",
|
"version": "112.11.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user