user13415628
user13415628

Reputation:

Discord Attachments Link

Well if you would like to get the attachments from a Discord message, you can do it by the following way:

attachements = message.attachments

But it cannot get attachments which are sent with a link.

Like the following 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)

They already have a different starting url.

How to extract them from the message?

Upvotes: 1

Views: 17148

Answers (1)

Łukasz Kwieciński
Łukasz Kwieciński

Reputation: 15728

Message.attachments returns a list of Attachment instances, you can loop through them and use the url attribute

attachments = message.attachments
urls = []

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

If you want a one-liner

urls = [attch.url for attch in attachments]

Upvotes: 0

Related Questions