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