feat(channels): add Mattermost integration for sovereign communication

This commit is contained in:
Vernon Stinebaker 2026-02-17 21:28:53 +08:00 committed by Chummy
parent 0aa35eb669
commit 7e3f5ff497
7 changed files with 408 additions and 3 deletions

View file

@ -1,4 +1,6 @@
use crate::channels::{Channel, DiscordChannel, SendMessage, SlackChannel, TelegramChannel};
use crate::channels::{
Channel, DiscordChannel, MattermostChannel, SendMessage, SlackChannel, TelegramChannel,
};
use crate::config::Config;
use crate::cron::{
due_jobs, next_run_for_schedule, record_last_run, record_run, remove_job, reschedule_after_run,
@ -262,6 +264,20 @@ async fn deliver_if_configured(config: &Config, job: &CronJob, output: &str) ->
);
channel.send(&SendMessage::new(output, target)).await?;
}
"mattermost" => {
let mm = config
.channels_config
.mattermost
.as_ref()
.ok_or_else(|| anyhow::anyhow!("mattermost channel not configured"))?;
let channel = MattermostChannel::new(
mm.url.clone(),
mm.bot_token.clone(),
mm.channel_id.clone(),
mm.allowed_users.clone(),
);
channel.send(&SendMessage::new(output, target)).await?;
}
other => anyhow::bail!("unsupported delivery channel: {other}"),
}