问题
My code print out the message the user sends. However, when an embedded message gets sent, there is nothing on the terminal and nothing is read.
Is there a way for my bot to read embedded messages along with normal messages on discord
Python 3.8
client = discord.Client()
@client.event
async def on_message(message):
print(message.content)
client.run(token)
回答1:
You can get list of embeds from message with message.embeds
. Link for docs. Try this solution:
@client.event
async def on_message(message):
embeds = message.embeds # return list of embeds
for embed in embeds:
print(embed.to_dict()) # it's content of embed in dict
P.S. If your message has one embed you can use: embed_content_in_dict = message.embeds[0].to_dict()
来源:https://stackoverflow.com/questions/62601894/with-discord-py-is-there-a-way-to-read-embedded-messages