feat: do todos
This commit is contained in:
parent
fb14a6f9a0
commit
e5dd0206ca
4 changed files with 59 additions and 53 deletions
18
src/main.rs
18
src/main.rs
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue