diff --git a/README.md b/README.md index 47d0e75f..b50867ac 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Xiao is a Discord bot coded in JavaScript with The bot is no longer available for invite. You can self-host the bot, or use her on the [home server](https://discord.gg/sbMe32W). -## Commands (294) +## Commands (290) ### Utility: * **eval**: Executes JavaScript code. @@ -296,6 +296,7 @@ on the [home server](https://discord.gg/sbMe32W). * **owo**: OwO. * **pig-latin**: Converts text to pig latin. * **pirate**: Converts text to pirate. +* **portal-send**: Send a message to a portal channel. * **repeat**: Repeat text over and over and over and over (etc). * **reverse**: Reverses text. * **say**: Make me say what you want, master. @@ -322,14 +323,6 @@ on the [home server](https://discord.gg/sbMe32W). * **roman-numeral**: Converts a number to roman numerals. * **units**: Converts units to/from other units. -### Portal Messages: - -* **add-portal-channel**: Sets a channel to be a portal channel. -* **fix-portal-channels**: Removes no longer existent channels from the portal list. -* **portal-send**: Send a message to a portal channel. -* **portal-status**: Shows the number of currently opened portals. -* **remove-portal-channel**: Remove a channel from the portal channels. - ### Other: * **cleverbot**: Chat with Cleverbot. diff --git a/Xiao.js b/Xiao.js index db4a6dd1..b6b5568a 100644 --- a/Xiao.js +++ b/Xiao.js @@ -28,7 +28,6 @@ client.registry ['avatar-edit', 'Avatar Manipulation'], ['text-edit', 'Text Manipulation'], ['number-edit', 'Number Manipulation'], - ['portal', 'Portal Messages'], ['other', 'Other'], ['roleplay', 'Roleplay'] ]) diff --git a/commands/portal/add-channel.js b/commands/portal/add-channel.js deleted file mode 100644 index 1edd6823..00000000 --- a/commands/portal/add-channel.js +++ /dev/null @@ -1,32 +0,0 @@ -const Command = require('../../structures/Command'); - -module.exports = class AddPortalChannelCommand extends Command { - constructor(client) { - super(client, { - name: 'add-portal-channel', - aliases: ['set-portal-channel', 'portal-channel', 'open-portal'], - group: 'portal', - memberName: 'add-channel', - description: 'Sets a channel to be a portal channel.', - guildOnly: true, - userPermissions: ['MANAGE_CHANNELS'], - args: [ - { - key: 'channel', - prompt: 'What channel do you want to set as a portal channel?', - type: 'channel', - default: msg => msg.channel - } - ] - }); - } - - run(msg, { channel }) { - if (channel.type !== 'text') return msg.reply('Only text channels can have a portal!'); - const channels = this.client.provider.get('global', 'portals', []); - if (channels.includes(channel.id)) return msg.reply(`${channel} already has an open portal!`); - channels.push(channel.id); - this.client.provider.set('global', 'portals', channels); - return msg.say(`A portal opened in ${channel}!`); - } -}; diff --git a/commands/portal/fix-channels.js b/commands/portal/fix-channels.js deleted file mode 100644 index eb3c6a45..00000000 --- a/commands/portal/fix-channels.js +++ /dev/null @@ -1,27 +0,0 @@ -const Command = require('../../structures/Command'); - -module.exports = class FixPortalChannelsCommand extends Command { - constructor(client) { - super(client, { - name: 'fix-portal-channels', - aliases: ['fix-portals'], - group: 'portal', - memberName: 'fix-channels', - description: 'Removes no longer existent channels from the portal list.', - ownerOnly: true - }); - } - - run(msg) { - const channels = this.client.provider.get('global', 'portals', []); - let count = 0; - for (const channel of channels) { - if (this.client.channels.has(channel)) continue; - channels.splice(channels.indexOf(channel), 1); - count++; - } - if (!channels.length) this.client.provider.remove('global', 'portals'); - else this.client.provider.set('global', 'portals', channels); - return msg.say(`Cleared **${count}** channels from the portal list.`); - } -}; diff --git a/commands/portal/remove-channel.js b/commands/portal/remove-channel.js deleted file mode 100644 index b08254d0..00000000 --- a/commands/portal/remove-channel.js +++ /dev/null @@ -1,33 +0,0 @@ -const Command = require('../../structures/Command'); - -module.exports = class RemovePortalChannelCommand extends Command { - constructor(client) { - super(client, { - name: 'remove-portal-channel', - aliases: ['delete-portal-channel', 'close-portal'], - group: 'portal', - memberName: 'remove-channel', - description: 'Remove a channel from the portal channels.', - guildOnly: true, - userPermissions: ['MANAGE_CHANNELS'], - args: [ - { - key: 'channel', - prompt: 'What channel do you want to remove from the portal channels?', - type: 'channel', - default: msg => msg.channel - } - ] - }); - } - - run(msg, { channel }) { - if (channel.type !== 'text') return msg.reply('Only text channels can have a portal!'); - const channels = this.client.provider.get('global', 'portals', []); - if (!channels.includes(channel.id)) return msg.reply(`${channel} does not have an open portal!`); - channels.splice(channels.indexOf(channel.id), 1); - if (!channels.length) this.client.provider.remove('global', 'portals'); - else this.client.provider.set('global', 'portals', channels); - return msg.say(`The portal in ${channel} closed...`); - } -}; diff --git a/commands/portal/status.js b/commands/portal/status.js deleted file mode 100644 index 14471f8c..00000000 --- a/commands/portal/status.js +++ /dev/null @@ -1,22 +0,0 @@ -const Command = require('../../structures/Command'); - -module.exports = class PortalStatusCommand extends Command { - constructor(client) { - super(client, { - name: 'portal-status', - group: 'portal', - memberName: 'status', - description: 'Shows the number of currently opened portals.' - }); - } - - run(msg) { - const channels = this.client.provider.get('global', 'portals', []); - const local = msg.channel.type === 'text' ? channels.filter(c => msg.guild.channels.has(c)).length : 0; - return msg.say( - `There are currently **${channels.length}** open portals${msg.channel.type === 'text' - ? `, **${local}** of which are in this server.` - : '.'}` - ); - } -}; diff --git a/commands/portal/send.js b/commands/text-edit/portal-send.js similarity index 75% rename from commands/portal/send.js rename to commands/text-edit/portal-send.js index c40550f7..a9a61ba6 100644 --- a/commands/portal/send.js +++ b/commands/text-edit/portal-send.js @@ -5,8 +5,8 @@ module.exports = class PortalSendCommand extends Command { super(client, { name: 'portal-send', aliases: ['send-portal-message', 'portal-message', 'send-portal-msg', 'portal-msg'], - group: 'portal', - memberName: 'send', + group: 'text-edit', + memberName: 'portal-send', description: 'Send a message to a portal channel.', args: [ { @@ -21,10 +21,12 @@ module.exports = class PortalSendCommand extends Command { async run(msg, { message }) { if (/discord(\.gg|app\.com\/invite|\.me)\//gi.test(message)) return msg.reply('Please do not send invites.'); - let channels = this.client.provider.get('global', 'portals', []).filter(c => this.client.channels.has(c)); + let channels = this.client.channels.filter( + channel => channel.type === 'text' && channel.topic && channel.topic.includes('') + ); if (msg.channel.type === 'text') channels = channels.filter(channel => !msg.guild.channels.has(channel)); - if (!channels.length) return msg.reply('No channels have an open portal...'); - const channel = this.client.channels.get(channels[Math.floor(Math.random() * channels.length)]); + if (!channels.size) return msg.reply('No channels have an open portal...'); + const channel = channels.random(); try { await channel.send(`**${msg.author.tag} (${msg.channel.type !== 'text' ? 'DM' : msg.guild.name})**: ${message}`); return msg.say(`Message sent to **${channel.name}** in **${channel.guild.name}**!`); diff --git a/package.json b/package.json index ee220243..fa870eb1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "85.1.1", + "version": "85.1.2", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {