feat: add events module with BridgeEvent, ControlCommand, OwncastState types

Made-with: Cursor
This commit is contained in:
cottongin
2026-03-10 21:52:17 -04:00
parent bc11ead8d8
commit f2e3c88b60
2 changed files with 52 additions and 0 deletions

51
src/events.rs Normal file
View File

@@ -0,0 +1,51 @@
use tokio::sync::oneshot;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Source {
Irc,
Owncast,
}
#[derive(Debug, Clone)]
pub enum BridgeEvent {
ChatMessage {
source: Source,
username: String,
body: String,
id: Option<String>,
},
StreamStarted {
title: String,
},
StreamStopped,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum OwncastState {
Online,
OfflineChatOpen,
Unavailable,
}
#[derive(Debug)]
pub enum ControlCommand {
IrcConnect,
IrcDisconnect,
IrcReconnect,
OwncastConnect,
OwncastDisconnect,
OwncastReconnect,
Status {
reply: oneshot::Sender<BridgeStatus>,
},
Quit,
}
#[derive(Debug, Clone, serde::Serialize)]
pub struct BridgeStatus {
pub irc_connected: bool,
pub owncast_state: String,
pub webhook_listening: bool,
pub websocket_connected: bool,
pub uptime_secs: u64,
}

View File

@@ -1,4 +1,5 @@
mod config;
mod events;
fn main() {
println!("owncast-irc-bridge");