N
N
NbUser1432021-01-16 18:45:30
Python
NbUser143, 2021-01-16 18:45:30

How to infer that {} values ​​are taken into account?

Hello!
I have a database that stores embed text for commands. (sqlite3)
And for example, if the database contains the text `Hi, {member.mention}`, which, when sent, does not take into account the value of {member.mention} and simply writes it as it is, but I wanted the member to ping, that is, it was sent as `Hi, user_whose_registration_in_the_team`. Code below:

@client.command()
async def hello(ctx, member : discord.Member):
    embed_result = check_embed(text_embed, name, guild_id) # получаю ембед
    embed = discord.Embed(color = 0x696969)
    embed.description = f'{embed_result}' # здесь по идеи должен вставляться {member.mention}
    await ctx.send(embed = embed)

Can you please tell me how to make a conclusion from the database so that {} is taken into account?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-01-16
@NbUser143

Make a replacement

embed.description = embed_result.replace('{member.mention}', member.mention)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question