A Discord Bot that Clears a Channel of all messages.
This bot/script deletes all messages of a channel from newest to oldest sent
See clear-channel.py
for script.
Steps:
- Download the clear-channel.py script in the repo above.
- Create a folder to put the
clear-channel.py
script in. - Open a terminal in that folder location.
- In that terminal run the following:
pip install discord.py
- Now edit the
clear-channel.py
script and add the needed values beingYOUR_BOT_TOKEN
,SERVER_ID
andCHANNEL_ID
.
See the following:
OR:
- Navigate to https://discord.com/developers/applications and click on your application.
- Click on the
Bot
option in the left navbar and make sure to enable the following:Presence Intent
,Server Members Intent
andMessage Content Intent
. - Now click on the
OAuth2
option in the left navbar and copy theClient ID
. - Now open https://discordapi.com/permissions.html in a new browser tab.
- Tick the boxes next to:
Administrator
,Manage Messages
,Manage Channels
,Manage Events
,Send Messages
,Embed Links
,Attach Files
,Read Message History
,Manage Server
,View Channels
andManage Server
. - Now paste your
Client ID
that you copied in theClient ID:
field at the bottom of the page. - Now click on the link provided at the way bottom of the page.
- Add your bot/application to your chosen server.
- Click Continue.
- Now in the terminal that's in the directory which has your
clear-channel.py
script run the following to excecute the script/bot:
python clear-channel.py
- Now your script/bot should run smoothly and delete all messages of a channel from newest to oldest sent.
PS:
YOUR_BOT_TOKEN
and SERVER_ID
should all be enclosed in single qoutations while:
CHANNEL_ID
should not be enclosed in qoutations at all.