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 :: django get superuser password 
Python :: sort_values 
Python :: pandas drop rows with null in specific column 
Python :: convert grayscale to rgb python 
Python :: python check operating system 
Python :: pandas datetime show only date 
Python :: numpy remove rows containing nan 
Python :: python console animation 
Python :: runserver manage.py 
Python :: proxy selenium python 
Python :: how to install flask 
Python :: python ffmpeg 
Python :: message on member joining discord.py 
Python :: how to plot a graph using matplotlib 
Python :: how to take list of float as input in python 
Python :: plotly add hline dashed 
Python :: random from list python 
Python :: convert unix timestamp to datetime python pandas 
Python :: yesterday in python 
Python :: min max and avg function of python 
Python :: random select algo 
Python :: WARNING: This is a development server. Do not use it in a production deployment. 
Python :: python playsound stop 
Python :: pandas dataframe histogram 
Python :: how to clear the console python 
Python :: how to see the functions of a library in python 
Python :: write object to file python 
Python :: write custom query odoo 
Python :: python create file if not exists 
Python :: get rid of axes numbers matplotlib 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =