Portal allows attachments

This commit is contained in:
Dragon Fire
2020-07-05 22:17:56 -04:00
parent 72c34d6384
commit ef6a52ce80
2 changed files with 7 additions and 2 deletions
+6 -1
View File
@@ -1,5 +1,6 @@
const Command = require('../../structures/Command'); const Command = require('../../structures/Command');
const { stripInvites } = require('../../util/Util'); const { stripInvites } = require('../../util/Util');
const { stripIndents } = require('common-tags');
const { PORTAL_EMOJI_ID, PORTAL_EMOJI_NAME } = process.env; const { PORTAL_EMOJI_ID, PORTAL_EMOJI_NAME } = process.env;
module.exports = class PortalSendCommand extends Command { module.exports = class PortalSendCommand extends Command {
@@ -38,7 +39,11 @@ module.exports = class PortalSendCommand extends Command {
const channel = channels.random(); const channel = channels.random();
try { try {
const displayName = msg.guild ? msg.guild.name : 'DM'; const displayName = msg.guild ? msg.guild.name : 'DM';
await channel.send(`**${this.portalEmoji} ${msg.author.tag} (${displayName}):** ${message}`); const attachments = msg.attachments.size ? msg.attachments.map(a => a.url).join('\n') : null;
await channel.send(stripIndents`
**${this.portalEmoji} ${msg.author.tag} (${displayName}):** ${message}
${attachments || ''}
`);
return msg.say(`Message sent to **${channel.name}** in **${channel.guild.name}**!`); return msg.say(`Message sent to **${channel.name}** in **${channel.guild.name}**!`);
} catch { } catch {
return msg.reply('Failed to send the message. Try again later!'); return msg.reply('Failed to send the message. Try again later!');
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "xiao", "name": "xiao",
"version": "119.9.0", "version": "119.9.1",
"description": "Your personal server companion.", "description": "Your personal server companion.",
"main": "Xiao.js", "main": "Xiao.js",
"scripts": { "scripts": {