Skip to content

Commit

Permalink
bot: Add SEND_SLACK_MESSAGES env variable
Browse files Browse the repository at this point in the history
When set, bot will send messages to Slack

When set, bot will send slack notifications
  • Loading branch information
alex-at-planetariummusic committed Jan 19, 2023
1 parent 221c50d commit 41b3522
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bot/src/slack_utils.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
use crate::BoxResult;
use log::info;
use reqwest::Url;
use std::collections::HashMap;
use std::env;

const SLACK_API_URL: &str = "https://slack.com/api/";

pub fn send_slack_channel_message(message: &str) -> BoxResult<()> {
if env::var("SEND_SLACK_MESSAGES").is_err() {
info!("Slack message that was not sent: {:?}", message);
return Ok(());
}

let (token, channel_id) = get_token_and_channel()?;
let client = reqwest::blocking::Client::new();

Expand Down

0 comments on commit 41b3522

Please sign in to comment.