Yeah . Question present in the title.How to get the url of an image present in an embed sent by an user using discord.py. I tried using this code:
@bot.event
async def on_message(message):
if message.channel.id == 787662710787145760:
try:
print(message.attachments[0].url)
except IndexError:
pass
await bot.process_commands(message)
However only works on images.
Answering to your comment, yes, it is possible to get the url of an embed
@bot.event
async def on_message(message):
if message.embeds: # Checking if there are any embeds in the message
embed = message.embeds[0] # Bots can only send 1 embed at a time, webhooks can multiple
print(embed.image.url)