Discord 附件 Link

Discord Attachments Link

如果您想从 Discord 消息中获取附件,可以通过以下方式进行:

attachements = message.attachments

但是它无法获取使用 link 发送的附件。

喜欢以下links:

https://media.discordapp.net/attachments/722437402685341766/801262293693890580/banner.gif
https://cdn.discordapp.com/attachments/281595941746900992/710992416039108748/unknown.png(I got it from a spam report)

他们已经有了不同的开始 url。

如何从邮件中提取它们?

Message.attachments returns Attachment 个实例的列表,您可以遍历它们并使用 url 属性

attachments = message.attachments
urls = []

for attch in attachments:
    urls.append(attch.url)

如果你想要一条线

urls = [attch.url for attch in attachments]