我需要从消息中获取图片,如果它在那里我使用重写版本
我试过这个:
message.attachments[0]['url']
但得到一个错误
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
如果你只留下索引或只留下附件,你会得到:
<discord.message.Attachment object at 0x00000228B8E3BE80>
我怎样才能得到图片网址?
RISEBY
相关分类