feat: do todos

This commit is contained in:
Soph :3 2025-09-10 07:19:57 +03:00
parent fb14a6f9a0
commit e5dd0206ca
4 changed files with 59 additions and 53 deletions

View file

@ -15,6 +15,8 @@ use crate::client::Client;
use crate::client::ClientEvent;
use crate::commands::Arguments;
use crate::commands::CommandRegistry;
use std::collections::HashMap;
use cap::Cap;
use serde::Deserialize;
use sqlx::postgres::PgPoolOptions;
@ -46,25 +48,27 @@ macro_rules! register_all {
)+
};
}
#[derive(Deserialize)]
struct Configuration {
#[derive(Deserialize, Clone)]
pub struct Configuration {
database: DatabaseConfig,
commands: CommandsConfig,
client: ClientConfig,
}
#[derive(Deserialize)]
#[derive(Deserialize, Clone)]
struct DatabaseConfig {
url: String,
}
#[derive(Deserialize)]
#[derive(Deserialize, Clone)]
struct CommandsConfig {
prefix: String,
name: String,
copyparty: String,
playlists: HashMap<String, Vec<String>>,
}
#[derive(Deserialize)]
#[derive(Deserialize, Clone)]
struct ClientConfig {
token: String,
ws: String,
@ -98,9 +102,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
registry,
client,
[
PlayCommand::new(midi_state.clone()),
PlayCommand::new(midi_state.clone(), conf.clone()),
StopCommand::new(midi_state.clone()),
PlaylistCommand::new(midi_state.clone()),
PlaylistCommand::new(midi_state.clone(), conf.clone()),
QueueCommand::new(midi_state.clone()),
SkipCommand::new(midi_state),
LaunchCommand,