message.attachments is collection, message.embeds is array
This commit is contained in:
parent
dd3a06ae3e
commit
ba00357f30
3
index.js
3
index.js
@ -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,
|
||||
|
Reference in New Issue
Block a user