M
M
Moto Moto2021-07-30 18:20:54
Python
Moto Moto, 2021-07-30 18:20:54

How to make bot message delete function like juniperbot?

bot.remove_command("help");
@bot.command()
async def help(ctx):
    author = ctx.message.author;
    await ctx.send(author.mention,
        embed = discord.Embed(
            title = "Help",
            description = "**!ban** - ban users...\n**!unban** - unban users\n**!kick** - kick users\n\n**!mute** - mute users\n**!unmute** - unmute users",
            color = discord.Colour.from_rgb(245, 73, 73)
            )
        );


Recently, I started writing a bot for my server in the discord and decided in the "help" function to automatically delete the message (what the bot sends) after a while, like a juniper.

Can you suggest how this can be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shurshur, 2021-07-30
@6IXK1LL

Just take it and remove it. For example, to delete 10 seconds after sending, you can do this:

sent_message = await ctx.send(...)
await asyncio.sleep(10)
await sent_message.delete()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question