Skip to content

IrishTechCommunity/destalinator

 
 

Repository files navigation

destalinator

Code for managing Cleanup of Stale Channels

Build Status

Making it work in your environment

You'll need to install a few libraries: pip install -r requirements.txt

You'll also need to change configuration.yaml appropriately. warner.py and archiver.py should then work from the command line. Productionalized automated deployments and running on a schedule are left unspecified because every production environment is unique.

Components

warner

The warner notifies channels that have been inactive for a period of time.

archiver

The archiver archives channels that have been inactive for a period of time.

announcer

The announcer will notify a channel of all new channels created within a period of time.

flagger

The flagger uses a ruleset defined in a specific channel to perform actions such as notifying channels of messages that have received a certain number of reactions.

Setup

Inside configuration.yaml

slack_name

You'll want to change this to the name of your Slack

warn_threshold and archive_threshold

Tune these two variables to decide how long after inactivity a channel should be warned for inactivity and then subsequently archived.

general_message_channel, announce_channel, control_channel, and log_channel

These channels need to be manually created by you in your Slack.

Required environment variables

SB_TOKEN

  1. Make sure the Slackbot app is installed for your Slack
  2. Add a Slackbot integration, and copy the token parameter from the URL provided

API_TOKEN

The easiest way to get an API_TOKEN is to generate an OAuth test token.

It's not nice, but it's simple and avoids the whole callback-URL-oauth-request-app-creation dance.

If you run into rate limits on your test token, you may need to set up a Slack App. Create a new one and give it the following permissions:

  • channels:history
  • channels:read
  • channels:write
  • chat:write:bot
  • chat:write:user
  • emoji:read
  • users:read

DESTALINATOR_ACTIVATED

Destalinator can be chatty and make potentially big changes to a Slack team (by warning or archiving a large amount of channels), especially when first installed.

To minimize the risk of making a mistake, Destalinator will run in a dry-run mode unless the DESTALINATOR_ACTIVATED environment variable exists. Set it to any non-empty value and Destalinator is "active." If you want to remain in dry-run mode, ensure this variable is unset/does not exist.

DESTALINATOR_LOG_LEVEL

Tune your preferred log level for server logs or local debugging. Does not affect the ENV var specified by output_debug_env_varname.

About

Code for managing Cleanup of Stale Channels

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%