Move chat system into core, merge configs, save to database

This commit is contained in:
NG (Graham) committed 2025-05-23 16:47:09 -04:00
1 parent b83a23c115
commit 4f0bcde7d8
29 files changed
+362 -331

No files matched your search

+31
View File
@@ -4,8 +4,34 @@ use serde::{Serialize, Deserialize};
pub struct ChatConfig {
#[serde(default = "default_pub_channs")]
pub public_channels: Vec<String>,
#[serde(default = "default_command_chann")]
pub command_channel: String,
pub commands: Vec<ChatCommand>,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
pub struct ChatCommand {
pub regex: String,
pub op: ChatOperation,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(tag = "type")]
pub enum ChatOperation {
BuiltIn(BuiltInChatOperation),
Custom,
#[serde(alias = "No-op")]
Nop,
}
#[derive(Serialize, Deserialize, Clone, Debug)]
#[serde(tag = "built_in")]
pub enum BuiltInChatOperation {
OnlineUsers,
TotalUsers,
}
fn default_pub_channs() -> Vec<String> {
vec![
"main".to_owned(),
@@ -13,3 +39,8 @@ fn default_pub_channs() -> Vec<String> {
"openjam_worship".to_owned(),
]
}
fn default_command_chann() -> String {
"sys".to_owned()
}