Skip to content

PoppinUK/slackbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

logo

Slack Channel Management Bot

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.


Features

Reaction-Based Channel Archiving

Admins can archive channels using reactions.

How it works:

  1. The bot posts a confirmation message.

  2. React with:

    • 🟢 :large_green_circle: to confirm archive
    • 🔴 :red_circle: to cancel
  3. The bot joins the target channel and archives it automatically.


Slash Commands

/clear

Delete messages in the current channel.

/clear

Deletes your recent messages.

/clear all

Deletes all recent messages in the channel (admin only).


/createchannel [name]

Creates a new Slack channel.

Example:

/createchannel project-updates

The command will:

  • Create the channel
  • Invite the user who ran the command

/delchannel

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.


/stafflist

Displays a button linking to an internal staff list.


/website

Displays a button linking to the main website.


Tech Stack

  • 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

Environment Variables

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.


Slack App Setup

  1. Create a Slack App
  2. Enable Event Subscriptions
  3. Set the request URL to your deployment endpoint:
/events
  1. Subscribe to the event:
reaction_added
  1. Create slash commands pointing to your deployment:
/clear
/createchannel
/delchannel
/stafflist
/website

Security Notes

To keep your bot secure:

  • Store tokens in environment variables
  • Never commit secrets to GitHub
  • Use Slack signing secret verification if deploying publicly

Example Use Cases

This bot can be used for:

  • Team moderation
  • Channel management
  • Internal tools
  • Workflow automation

License

MIT License

About

A lightweight Slack bot for managing channels and moderation tasks using the Slack Events API and Slash Commands.

Topics

Resources

License

Stars

Watchers

Forks

Contributors