0
votes

Part of my discord bot has a reaction role event. I got the reaction role part to work but I want it to add a message to the react role channel. I got that part to work as well. However, I cannot get the bot to delete the message that it sent the channel a few seconds later. I tried the await delete() function but it is not working. Here is the code:

if member is not None:
                await member.add_roles(role)
                print('>>>Role Added.')
                channel = client.get_channel(692231831885709322)
                m = await channel.send('Regional Role was added')
                await # delete message
1

1 Answers

0
votes

The delete coroutine has a delay parameter. You can use that to set a delay before deleting in seconds.

if member is not None:
    await member.add_roles(role)
    print('>>>Role Added.')
    channel = client.get_channel(692231831885709322)
    m = await channel.send('Regional Role was added')
    await m.delete(delay = 5)