Remove unnecessary server config

This commit is contained in:
Joscha 2024-12-28 19:00:09 +01:00
parent c71b2dbf22
commit dac2fb06d3

View file

@ -1,6 +1,6 @@
use std::{fmt::Debug, sync::Arc}; use std::{fmt::Debug, sync::Arc};
use euphoxide_client::{MultiClient, MultiClientConfig, MultiClientEvent, ServerConfig}; use euphoxide_client::{MultiClient, MultiClientConfig, MultiClientEvent};
use log::error; use log::error;
use tokio::sync::mpsc; use tokio::sync::mpsc;
@ -8,31 +8,23 @@ use crate::command::Commands;
#[non_exhaustive] #[non_exhaustive]
pub struct Bot<E = euphoxide::Error> { pub struct Bot<E = euphoxide::Error> {
pub server_config: ServerConfig,
pub commands: Arc<Commands<E>>, pub commands: Arc<Commands<E>>,
pub clients: MultiClient, pub clients: MultiClient,
} }
impl Bot { impl Bot {
pub fn new_simple(commands: Commands, event_tx: mpsc::Sender<MultiClientEvent>) -> Self { pub fn new_simple(commands: Commands, event_tx: mpsc::Sender<MultiClientEvent>) -> Self {
Self::new( Self::new(MultiClientConfig::default(), commands, event_tx)
ServerConfig::default(),
MultiClientConfig::default(),
commands,
event_tx,
)
} }
} }
impl<E> Bot<E> { impl<E> Bot<E> {
pub fn new( pub fn new(
server_config: ServerConfig,
clients_config: MultiClientConfig, clients_config: MultiClientConfig,
commands: Commands<E>, commands: Commands<E>,
event_tx: mpsc::Sender<MultiClientEvent>, event_tx: mpsc::Sender<MultiClientEvent>,
) -> Self { ) -> Self {
Self { Self {
server_config,
commands: Arc::new(commands), commands: Arc::new(commands),
clients: MultiClient::new_with_config(clients_config, event_tx), clients: MultiClient::new_with_config(clients_config, event_tx),
} }
@ -56,7 +48,6 @@ where
impl<E> Clone for Bot<E> { impl<E> Clone for Bot<E> {
fn clone(&self) -> Self { fn clone(&self) -> Self {
Self { Self {
server_config: self.server_config.clone(),
commands: self.commands.clone(), commands: self.commands.clone(),
clients: self.clients.clone(), clients: self.clients.clone(),
} }