how to delete a message in discord.py code example
Example 1: how to make a discord bot delete messages python
import discord
@client.event
async def on_message(message):
response = await message.channel.send("Hello")
await message.delete()
await response.delete()
Example 2: delete message discord.py
@client.event
async def on_message(message):
await message.delete()
Example 3: discord.py delete own message
include time
@bot.event
async def on_message(message):
if not message.content == "HI":
return
BotMessage = await ctx.send("HI")
time.sleep(3)
BotMessage.delete()