diff --git a/commands/single-res/nitro.js b/commands/single-res/nitro.js new file mode 100644 index 00000000..d7aa39da --- /dev/null +++ b/commands/single-res/nitro.js @@ -0,0 +1,32 @@ +const { Command } = require('discord.js-commando'); +const { MessageEmbed } = require('discord.js'); +const { stripIndents } = require('common-tags'); + +module.exports = class NitroCommand extends Command { + constructor(client) { + super(client, { + name: 'nitro', + aliases: ['discord-nitro', 'nitro-message', 'nitro-msg'], + group: 'single-res', + memberName: 'nitro', + description: 'Sends the "This message can only be viewed by users with Discord Nitro." message.', + clientPermissions: ['EMBED_LINKS'] + }); + } + + run(msg) { + const embed = new MessageEmbed() + .setAuthor('Discord Nitro', 'https://i.imgur.com/DKaY8fV.jpg') + .setURL('https://discordapp.com/nitro') + .setThumbnail('https://i.imgur.com/DKaY8fV.jpg') + .setColor(0x8395D3) + .setTimestamp() + .setDescription(stripIndents` + This message can only be viewed by users with Discord Nitro. + + + [More Information](https://discordapp.com/nitro) + `); + return msg.embed(embed); + } +}; diff --git a/commands/text-edit/portal-send.js b/commands/text-edit/portal-send.js new file mode 100644 index 00000000..6e14d028 --- /dev/null +++ b/commands/text-edit/portal-send.js @@ -0,0 +1,38 @@ +const { Command } = require('discord.js-commando'); + +module.exports = class PortalSendCommand extends Command { + constructor(client) { + super(client, { + name: 'portal-send', + 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 `` in the topic.', + args: [ + { + key: 'text', + prompt: 'What text would you like to send?', + type: 'string', + validate: text => { + if (/discord(\.gg|app\.com\/invite|\.me)\//gi.test(text)) return 'Please do not send invites.'; + if (text.length < 1000) return true; + return 'Invalid text, please keep the text under 1000 characters.'; + } + } + ] + }); + } + + async run(msg, { text }) { + 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('')); + if (!channels.size) return msg.say('No channels on this shard have an open portal.'); + const channel = channels.random(); + try { + await channel.send(`**${msg.author.tag} (${msg.guild.name})**: ${text}`); + return msg.say(`Message sent to **${channel.name}** in **${channel.guild.name}**!`); + } catch (err) { + return msg.say('Failed to send the message. Try again later!'); + } + } +}; diff --git a/package.json b/package.json index e1ff7e7d..4b5bb49f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaobot", - "version": "47.8.0", + "version": "47.9.0", "description": "Your personal server companion.", "main": "Shard.js", "scripts": {