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

+7
View File
@@ -281,4 +281,11 @@ impl <C: Clone> super::ConfigProvider<C> for CubeConfig {
fn cubes(&self) -> &'_ std::collections::HashMap<String, crate::persist::Cube> {
&self.cubes
}
fn chat_system_config(&self) -> super::ChatSystemConfig {
super::ChatSystemConfig {
command_channel: self.chat.command_channel.clone(),
commands: self.chat.commands.clone(),
}
}
}
+1 -1
View File
@@ -2,7 +2,7 @@ mod cubes_json;
pub use cubes_json::CubeConfig;
mod traits;
pub use traits::{ConfigProvider, CompleteCampaignProvider, DevMessageProvider, ServerConfig, GarageUpgrades, GarageUpgradeIncrement};
pub use traits::{ConfigProvider, CompleteCampaignProvider, DevMessageProvider, ServerConfig, GarageUpgrades, GarageUpgradeIncrement, ChatSystemConfig};
pub type ConfigImpl = CubeConfig;
+7
View File
@@ -23,6 +23,7 @@ pub trait ConfigProvider<C: Clone> {
fn garage_upgrades(&self) -> GarageUpgrades;
async fn factory(&self) -> Result<crate::factory::Factory, Box<dyn std::error::Error + 'static>>;
fn cubes(&self) -> &'_ std::collections::HashMap<String, crate::persist::Cube>;
fn chat_system_config(&self) -> ChatSystemConfig;
}
pub struct CompleteCampaignProvider {
@@ -121,3 +122,9 @@ impl GarageUpgrades {
].into())
}
}
#[derive(Clone, Debug)]
pub struct ChatSystemConfig {
pub command_channel: String,
pub commands: Vec<crate::persist::ChatCommand>,
}