A lightweight Slack bot for managing channels and moderation tasks using the Slack Events API and Slash Commands.
This bot allows administrators and users to perform moderation actions such as clearing messages, creating channels, archiving channels with reaction confirmations, and accessing internal resources.
Designed to run in a serverless environment (this bot runs on Cloudflare Workers).
⚠️ Note: Sensitive information such as user IDs, internal URLs, and tokens has been removed or replaced with placeholders in this repository.
Admins can archive channels using reactions.
How it works:
-
The bot posts a confirmation message.
-
React with:
- 🟢
:large_green_circle:to confirm archive - 🔴
:red_circle:to cancel
- 🟢
-
The bot joins the target channel and archives it automatically.
Delete messages in the current channel.
/clear
Deletes your recent messages.
/clear all
Deletes all recent messages in the channel (admin only).
Creates a new Slack channel.
Example:
/createchannel project-updates
The command will:
- Create the channel
- Invite the user who ran the command
Interactive channel archive tool.
/delchannel
The bot will show a list of available channels.
/delchannel [number]
The bot posts a confirmation message where an admin must react to approve the archive.
Displays a button linking to an internal staff list.
Displays a button linking to the main website.
- JavaScript
- Slack Events API
- Slack Web API
- Slack Slash Commands
- Serverless Runtime
Designed for deployment on platforms like:
- Cloudflare Workers
- Vercel Edge Functions
- Other serverless environments
The bot requires the following environment variables:
SLACK_BOT_TOKEN=your_slack_bot_token
Optional configuration:
ADMIN_USER_ID=slack_admin_user_id
These should never be committed to the repository.
- Create a Slack App
- Enable Event Subscriptions
- Set the request URL to your deployment endpoint:
/events
- Subscribe to the event:
reaction_added
- Create slash commands pointing to your deployment:
/clear
/createchannel
/delchannel
/stafflist
/website
To keep your bot secure:
- Store tokens in environment variables
- Never commit secrets to GitHub
- Use Slack signing secret verification if deploying publicly
This bot can be used for:
- Team moderation
- Channel management
- Internal tools
- Workflow automation
MIT License