Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to make a discord bot delete messages python

import discord 
 
@client.event 
async def on_message(message):
  	response = await message.channel.send("Hello") 
    # Deletes the message the user sent
	await message.delete() 
    # Deletes the responding message
	await response.delete() 
Comment

discord bot python delete messages like mee6

  async def on_message(self,message):
    	channel = bot.get_channel(channel_id)
        if message.content.startswith("!clear",):
            messages = await channel.history(limit=anynumber).flatten()
            for m in messages:
                msg = await channel.fetch_message(m.id)
                await msg.delete()
            print("done!")
Comment

PREVIOUS NEXT
Code Example
Python :: get prime number python 
Python :: print() 
Python :: tensorflow_version 
Python :: dropna in specific column pandas 
Python :: what is hashlib in python 
Python :: dataframe add row 
Python :: drop all characters after a character in python 
Python :: get columns by type pandas 
Python :: copy string python 
Python :: Send GIF in Embed discord.py 
Python :: split a variable into multiple variables in python 
Python :: create dictionary from keys and values python 
Python :: tkinter slider 
Python :: decision tree algorithm python 
Python :: roman to integer python 
Python :: how to use enumerate in python 
Python :: magic methods python 
Python :: plot background color matplotlib 
Python :: making a basic network scanner using python 
Python :: E: Unable to locate package python-gobject 
Python :: appending to a file in python 
Python :: Double-Linked List Python 
Python :: how to round an array in python 
Python :: python print variables and string 
Python :: get month day year 12 hour time format python 
Python :: python remove everything after character 
Python :: get name of variable python 
Python :: Get files from S3 bucket Python 
Python :: np one hot encoding 
Python :: python lambda function map 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =