I need to get a picture from the message if it is there I use rewritten version
I tried this:
message.attachments[0]['url']
But getting an error
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\vlad0\AppData\Roaming\Python\Python36\site-packages\discord\client.py", line 227, in _run_event
await coro(*args, **kwargs)
File "c:\Users\vlad0\Desktop\bot\bot.py", line 121, in on_message
print(message.attachments[0]['url'])
TypeError: 'Attachment' object is not subscriptable
If you leave only the index or only attachments, you get this:
<discord.message.Attachment object at 0x00000228B8E3BE80>
How can i get image url?
[]
is not the correct way to get information from an Attachment object. Perhaps you should check its properties instead.