Welcome to PurgeBot! This bot helps manage and clean up your Discord server by automatically purging old messages from channels based on your specified duration. Whether you need to clear out outdated messages or keep your channels tidy, PurgeBot has you covered.
Clone the repository:
git clone https://github.com/keshon/purge-bot.git
cd purge-bot
Install dependencies:
go mod tidy
Set up your environment:
Create a .env
file in the root directory with the following content:
DISCORD_KEY=your-discord-bot-token
Run the bot:
go run main.go
Automatically purge old messages in the channel.
@PurgeBot <duration>
@PurgeBot 30s
(purges messages older than 30 seconds)@PurgeBot
is just an example. The actual bot mention may vary based on the botโs name or configuration.Stop the active purge task in the channel.
@PurgeBot stop
Get a list of all channels with active purge tasks in the guild.
@PurgeBot list
Grant a user permission to manage purge tasks. You can use either username or user ID.
@PurgeBot adduser <username>
or @PurgeBot adduserid <userID>
@PurgeBot adduser JohnDoe
or @PurgeBot adduserid 339767128292982785
Revoke a userโs permission to manage purge tasks. You can use either username or user ID.
@PurgeBot removeuser <username>
or @PurgeBot removeuserid <userID>
@PurgeBot removeuser JohnDoe
or @PurgeBot removeuserid 339767128292982785
Grant a role permission to manage purge tasks. You can use either role name or role ID.
@PurgeBot addrole <roleName>
or @PurgeBot addroleid <roleID>
@PurgeBot addrole Admin
or @PurgeBot addroleid 1274017921756172403
Revoke a roleโs permission to manage purge tasks. You can use either role name or role ID.
@PurgeBot removerole <roleName>
or @PurgeBot removeroleid <roleID>
@PurgeBot removerole Admin
or @PurgeBot removeroleid 1274017921756172403
Get a list of all users and roles registered to manage purge tasks, including their names.
@PurgeBot listpermissions
Get detailed usage instructions and a list of available commands.
@PurgeBot help
To invite PurgeBot to your server, use the following invite link format:
https://discord.com/oauth2/authorize?client_id=YOUR_APPLICATION_ID&scope=bot&permissions=75776
Required Permissions:
Replace YOUR_APPLICATION_ID
in the URL with your botโs actual application ID from the Discord Developer Portal.
Hereโs how you can use PurgeBot in your server:
Start purging messages older than 1 hour:
@PurgeBot 1h
Stop purging in a channel:
@PurgeBot stop
Get a list of all purge tasks:
@PurgeBot list
Add a user to manage purge tasks:
@PurgeBot adduser JohnDoe
Remove a user from managing purge tasks:
@PurgeBot removeuser JohnDoe
Add a role to manage purge tasks:
@PurgeBot addrole Admin
Remove a role from managing purge tasks:
@PurgeBot removerole Admin
Get a list of all registered users and roles:
@PurgeBot listpermissions
Get help:
@PurgeBot help
PurgeBot was inspired by the original KMS Bot project. The original bot, written in Python, provided the foundational concept for this Go implementation. A special thanks to the creator of that project!