From cd14e164ef7eef60b49c7adf834932e18b7fc5d9 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 19 Jul 2020 13:04:19 +0200 Subject: [PATCH] IMAGES --- src/commands/reply.ts | 5 +++-- src/events/messageCreate.ts | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/commands/reply.ts b/src/commands/reply.ts index aed921ee..fcce62c3 100644 --- a/src/commands/reply.ts +++ b/src/commands/reply.ts @@ -14,12 +14,13 @@ export default new Command('reply', async (caller, cmd, userDB) => { const userEmbed = new MessageEmbed() .setAuthor(`${cmd.msg.author.username}#${cmd.msg.author.discriminator}`, cmd.msg.author.dynamicAvatarURL()) .setColor(COLORS.RED) - .setDescription(cmd.args.join(' ')) + .setDescription(cmd.args.join(' ') || 'No content provided.') .setTimestamp(); + if (files.length > 0) userEmbed.addField('Files', `This message contains ${files.length} file${files.length > 1 ? 's' : ''}`); const channelEmbed = new MessageEmbed() .setAuthor(`${cmd.msg.author.username}#${cmd.msg.author.discriminator}`, cmd.msg.author.dynamicAvatarURL()) .setColor(COLORS.GREEN) - .setDescription(cmd.args.join(' ')) + .setDescription(cmd.args.join(' ') || 'No content provided.') .setTimestamp(); caller.utils.discord.createMessage(cmd.channel.id, { embed: channelEmbed.code }, false, files); diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts index bc8b7fb8..0281153a 100644 --- a/src/events/messageCreate.ts +++ b/src/events/messageCreate.ts @@ -31,8 +31,9 @@ export default async (caller: Caller, msg: Message): Promise => { const guildEmbed = new MessageEmbed() .setAuthor(`${msg.author.username}#${msg.author.discriminator}`, msg.author.dynamicAvatarURL()) .setColor(COLORS.RED) - .setDescription(msg.content) + .setDescription(msg.content || 'No content provided.') .setTimestamp(); + if (files.length > 0) guildEmbed.addField('Files', `This message contains ${files.length} file${files.length > 1 ? 's' : ''}`); caller.utils.discord.createMessage(channel.id, {embed: guildEmbed.code}, false, files); } @@ -63,10 +64,11 @@ export default async (caller: Caller, msg: Message): Promise => { .setTitle(config.messages.open_notification || 'New Thread') .setThumbnail(msg.author.dynamicAvatarURL()) .setColor(COLORS.BLUE) - .setDescription(msg.content) + .setDescription(msg.content || 'No content provided.') .addField('User', `${msg.author.username}#${msg.author.discriminator} \`[${msg.author.id}]\``) .addField('Past Threads', userDB.total.toString()) .setTimestamp(); + if (files.length > 0) guildOpenEmbed.addField('Files', `This message contains ${files.length} file${files.length > 1 ? 's' : ''}`); caller.utils.discord.createMessage(msg.author.id, { embed: userOpenEmbed.code }, true); (channel as TextChannel).createMessage({ content: config.role_ping ? `<@&${config.role_ping}>` : '', embed: guildOpenEmbed.code }, files);