purge-bot

๐Ÿ—‘๏ธ PurgeBot ๐Ÿ—‘๏ธ

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.

๐Ÿš€ Features

๐Ÿ› ๏ธ Setup

1. Prerequisites

2. Installation

  1. Clone the repository:

     git clone https://github.com/keshon/purge-bot.git
     cd purge-bot
    
  2. Install dependencies:

     go mod tidy
    
  3. Set up your environment:

    Create a .env file in the root directory with the following content:

     DISCORD_KEY=your-discord-bot-token
    
  4. Run the bot:

     go run main.go
    

๐Ÿ“œ Commands

Purge Old Messages

Automatically purge old messages in the channel.

Stop Purge Task

Stop the active purge task in the channel.

List Purge Tasks

Get a list of all channels with active purge tasks in the guild.

Add User

Grant a user permission to manage purge tasks. You can use either username or user ID.

Remove User

Revoke a userโ€™s permission to manage purge tasks. You can use either username or user ID.

Add Role

Grant a role permission to manage purge tasks. You can use either role name or role ID.

Remove Role

Revoke a roleโ€™s permission to manage purge tasks. You can use either role name or role ID.

List Permissions

Get a list of all users and roles registered to manage purge tasks, including their names.

Help

Get detailed usage instructions and a list of available commands.

โš™๏ธ Configuration

๐Ÿ—ณ๏ธ Invite the Bot

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.

๐Ÿ“ Example

Hereโ€™s how you can use PurgeBot in your server:

  1. Start purging messages older than 1 hour:

     @PurgeBot 1h
    
  2. Stop purging in a channel:

     @PurgeBot stop
    
  3. Get a list of all purge tasks:

     @PurgeBot list
    
  4. Add a user to manage purge tasks:

     @PurgeBot adduser JohnDoe
    
  5. Remove a user from managing purge tasks:

     @PurgeBot removeuser JohnDoe
    
  6. Add a role to manage purge tasks:

     @PurgeBot addrole Admin
    
  7. Remove a role from managing purge tasks:

     @PurgeBot removerole Admin
    
  8. Get a list of all registered users and roles:

     @PurgeBot listpermissions
    
  9. Get help:

     @PurgeBot help
    

๐Ÿ™ Acknowledgements

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!