Search code examples
pythondiscorddiscord.pybots

Deleting a bot message after a while?


My bot welcomes new members, how do I delete the message after a while?

My code for the hello message:

@client.event
async def on_member_join(member):
    channel = client.get_channel(channelID)
    await channel.send(f'Hello')

Solution

  • Use delete_after kwarg.
    For example await channel.send(f'Hello', delete_after=60)