From 645eca17d168f9c7ebd9c863acba32be2090fff9 Mon Sep 17 00:00:00 2001 From: Emma Litwa-Vulcu Date: Fri, 17 Feb 2023 08:34:32 -0800 Subject: [PATCH] docs: readme update --- README.md | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index faa7a8c..b3f8e4f 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,50 @@ # Archive Bot -Slack bot helper for managing outdated and very small channels. +Slack bot helper for managing outdated and very small channels. In its current iteration, it runs +once and ends, meaning it is meant to be run on a schedule, such as a cron job or a Lambda function. ## Configuration Archive bot needs a bit of data to get started: -- Slack API Key +- Slack [Bot Token](https://api.slack.com/authentication/token-types#bot) - Notification [Channel ID](https://github.com/reiniiriarios/archive-bot/#finding-slack-channel-id) - Filter Prefixes (optional) + - The bot will ignore channels with these prefixes. - Messages (optional) + - Configure messages to send prefixing updates. - Staleness (optional) + - Configure how long a channel has to go without a message before it's considered "old." - Small Channel Threshold (optional) + - Configure how small a channel has to be before it's considered "small." ```rust let config = archive_bot::Config { + // Bot tokens look like: xoxb-xxxxxxxyourtokenxxxxxxx. token: env::var("SLACK_BOT_TOKEN").expect("Error: environment variable SLACK_BOT_TOKEN is not set."), + // Use the channel ID and not the name. notification_channel_id: env::var("SLACK_CHANNEL_ID").expect("Error: environment variable SLACK_CHANNEL_ID is not set."), + // Ignore channels beginning with these prefixes. filter_prefixes: vec!["-"], + // Messages to send (one is picked at random). message_headers: vec![ "Hey, you've got some cleaning up to do!", "Hey boss, take a look at these, will ya?", ], + // How long before a channel is stale (in seconds). stale_after: 2 * 7 * 24 * 60 * 60, + // How small a "small" channel is. small_channel_threshold: 3, + // Whether to send a secondary notification to a different channel (message only). + notify_secondary_channel: true, + // The ID of a secondary channel. + secondary_notification_channel_id: env::var("SLACK_CHANNEL_2_ID").expect("Error: environment variable SLACK_CHANNEL_2_ID is not set."), + // The message prefix to send to the secondary channel. Will be suffixed with a link to the primary channel. + secondary_message_headers: vec![ + "Hey folks! I, uh... made a list for you. Of channels. That you should archive. Maybe.", + "Hey everyone! If you want the satisfaction of crossing a task off your list, I have one!", + ], + ..archive_bot::Config::default() }; ``` @@ -32,7 +53,7 @@ Or, using default values: ```rust let config = archive_bot::Config { token: env::var("SLACK_BOT_TOKEN").expect("Error: environment variable SLACK_BOT_TOKEN is not set."), - notification_channel_id: "A01A02A03A04".to_string(), + notification_channel_id: "C01A02A03A04".to_string(), ..archive_bot::Config::default() }; ```