A
A
Andrey Volchara2020-12-24 20:39:57
Python
Andrey Volchara, 2020-12-24 20:39:57

How to check the content of a message?

How to implement checking for the author and content of the message?

@client.command(aliases=["give"])
async def __give(ctx, member: discord.Member = None, cash: int = None):
    if data_coin >= all_summ:
        randCode = ''.join(random.choice(ascii_uppercase) for i in range(6)) # генерирует набор букв (6 символов)
        embed=discord.Embed(color=0x2bca53) 
        embed.set_author(name=f"{ctx.guild.name}", icon_url=ctx.guild.icon_url_as(format='png'))
        embed.add_field(name="M̷o̷n̷e̷y̷ ̷T̷r̷a̷n̷s̷f̷e̷r̷  ", value=f'**{ctx.author.name}**, подтвердите перевод пользователю **{member.name}**\n**Комиссия перевода ** - {comission}\n**Сумма с учётом комиссии** - {all_summ}\n\n**Проверочный код** - {randCode}', inline=False)
        msg = await ctx.send(embed=embed)

In response, the bot should receive a message from the author with this code.
I see such a picture in my head, but I don’t understand how to implement it.
If the message is from the author and the message contains this code:
Run the currency transfer logic
Otherwise:
Send an error message

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Nevzorov, 2020-12-25
@vollchara

bot.wait_for(...): https://discordpy.readthedocs.io/en/stable/ext/com...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question