Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

discord.py - Creating a discord bot command that responds with multiple embed fields

I am creating a bot command that allows the user to create nice looking embeds on the server.

 @bot.command()
async def embed(ctx,title_str,text_str,url_str, feildname_list):
    my_embed=discord.Embed(title=title_str, url=url_str, description=text_str, color=0xFF5733)
    await ctx.send(embed=my_embed)

currently feildname_listis unused. what i'd like to do is to create a series of inline fields using the names from fieldname list, with an ascending integer in them.

like this:

enter image description here

Using the documentation I found this command

add_field(*, name, value, inline=True)

which works- but felt inelegant. It feels like there should be a way of adding the fields as a key word argument when I am creating my_embed- but i can't see one in the documentation. Is there such a way?

question from:https://stackoverflow.com/questions/65924339/creating-a-discord-bot-command-that-responds-with-multiple-embed-fields

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

no, there isn't a way to do what you ask


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...