mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Forgot to remove portal
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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']
|
||||
])
|
||||
|
||||
@@ -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}!`);
|
||||
}
|
||||
};
|
||||
@@ -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.`);
|
||||
}
|
||||
};
|
||||
@@ -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...`);
|
||||
}
|
||||
};
|
||||
@@ -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.`
|
||||
: '.'}`
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -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('<portal>')
|
||||
);
|
||||
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}**!`);
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "85.1.1",
|
||||
"version": "85.1.2",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user