message.attachments is collection, message.embeds is array

This commit is contained in:
Lamp 2019-10-08 17:43:52 -07:00
parent dd3a06ae3e
commit ba00357f30

@ -97,14 +97,13 @@
rcmsg.msg = message.cleanContent;
rcmsg.alias = message.member && message.member.displayName || message.author.username;
rcmsg.avatar = message.author.avatarURL || message.author.defaultAvatarURL;
rcmsg.attachments = message.attachments.map(attachment => ({
rcmsg.attachments = message.attachments.array().map(attachment => ({
title: attachment.filename,
title_link: attachment.url,
title_link_download: true,
image_url: attachment.width ? attachment.url : undefined,
audio_url: [".ogg", ".mp3", ".wav", ".flac"].some(ext=>attachment.filename.endsWith(ext)) ? attachment.url : undefined,
video_url: [".mp4", ".webm", ".mov", ".avi"].some(ext=>attachment.filename.endsWith(ext)) ? attachment.url : undefined
}).concat(message.embeds.map(embed => embed.type == "rich" ? {
author_name: embed.author && embed.author.name,
author_link: embed.author && embed.author.url,