mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 10:19:11 +02:00
Updates
This commit is contained in:
@@ -7,12 +7,12 @@ module.exports = class PortalSendCommand extends Command {
|
||||
aliases: ['send-portal-message', 'portal-message', 'send-portal-msg', 'portal-msg'],
|
||||
group: 'text-edit',
|
||||
memberName: 'portal-send',
|
||||
description: 'Send a message to a random channel with `<portal>` in the topic.',
|
||||
description: 'Send a message to a random channel with "<portal>" in the topic.',
|
||||
guildOnly: true,
|
||||
args: [
|
||||
{
|
||||
key: 'text',
|
||||
prompt: 'What text would you like to send?',
|
||||
key: 'message',
|
||||
prompt: 'What message would you like to send?',
|
||||
type: 'string',
|
||||
max: 1000
|
||||
}
|
||||
@@ -20,14 +20,14 @@ module.exports = class PortalSendCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { text }) {
|
||||
if (/discord(\.gg|app\.com\/invite|\.me)\//gi.test(text)) return msg.reply('Please do not send invites.');
|
||||
async run(msg, { message }) {
|
||||
if (/discord(\.gg|app\.com\/invite|\.me)\//gi.test(message)) return msg.reply('Please do not send invites.');
|
||||
const valid = this.client.channels.filter(channel => channel.type === 'text' && channel.guild.id !== msg.guild.id);
|
||||
const channels = valid.filter(channel => channel.topic && channel.topic.toLowerCase().includes('<portal>'));
|
||||
if (!channels.size) return msg.say('No channels have an open portal.');
|
||||
const channel = channels.random();
|
||||
try {
|
||||
await channel.send(`**${msg.author.tag} (${msg.guild.name})**: ${text}`);
|
||||
await channel.send(`**${msg.author.tag} (${msg.guild.name})**: ${message}`);
|
||||
return msg.say(`Message sent to **${channel.name}** in **${channel.guild.name}**!`);
|
||||
} catch (err) {
|
||||
return msg.reply('Failed to send the message. Try again later!');
|
||||
|
||||
Reference in New Issue
Block a user