Discord.py: How can I get the text from an embed's description?

Created on 11 Dec 2018  路  10Comments  路  Source: Rapptz/discord.py

Hi @Rapptz! I have this bot that assigns a mentioned user a certain role. I would like it that the bot doesn't only give the role to users mentioned in regular text, but in embeds as well. For example, let's say another bot mentions a user in a embed as a promotion. I want this bot to get the text from the embed, and use it the same way as if it got the text from a normal user's message. Thanks in advance! My bot: https://github.com/CompuGenius-Programs/moderator-for-a-day/blob/master/addroles.py

question

Most helpful comment

You probably shouldn鈥檛 reopen older issues, also for help with the library join the support server (link is in the README)

All 10 comments

@Harmon758 thanks for replying so quickly! These references are for getting the description, and not for merely creating them? Sure I'll join the server!

You can create Embed objects to send, as well as get their dictionary form from Message objects by using Message.embeds.

@Harmon758 how do I get there description? What does message.embeds print out? A list?

If you read the documentation, you would know.

I also just saw you on the Discord.py server. That's where these sorts of questions belong.

I know I was on the server, but they told me to check what you responded.

@Harmon758 in sorry man, but I'm still confused! Can you please send me sample code that will repost what the descriptions of the embed is? I'm really sorry that in driving you nuts!

As the documentation I linked to says, Message.embeds returns a list of embedded objects. These are dictionaries with the data from the Embeds. You can access the dictionary to get the description.

On the rewrite branch, Message.embeds will give you a list of Embed objects, with which you can get the description using the Embed.description attribute.

For further help, you should inquire on Discord. However, asking for code for what you want, instead of learning to write it yourself, is generally frowned upon.

Thanks so much!!!!!!!

You probably shouldn鈥檛 reopen older issues, also for help with the library join the support server (link is in the README)

Was this page helpful?
0 / 5 - 0 ratings