Handle event handler situation
This commit is contained in:
parent
e3d9f05954
commit
62712c44d4
|
|
@ -16,7 +16,6 @@ use serenity::framework::standard::{*, macros::*};
|
|||
use serenity::http::Http;
|
||||
use serenity::model::prelude::{GuildId, Message, UserId};
|
||||
use crate::error::ManifoldResult;
|
||||
use crate::events::Handler;
|
||||
use crate::responses::Responses;
|
||||
|
||||
pub mod config;
|
||||
|
|
@ -62,7 +61,7 @@ impl TypeMapKey for ManifoldConfig {
|
|||
#[commands(ping, set_config, get_config, version, set_activity, get_environment)]
|
||||
struct Core;
|
||||
|
||||
pub async fn prepare_client(arguments: ArgMatches<'_>, mut framework: StandardFramework) -> ManifoldResult<Client> {
|
||||
pub async fn prepare_client<T: 'static + EventHandler>(arguments: ArgMatches<'_>, mut framework: StandardFramework, event_handler: T) -> ManifoldResult<Client> {
|
||||
let bot_environment = arguments.value_of("environment").unwrap_or("Production").to_string();
|
||||
let config_file = format!("config/{}", arguments.value_of("config-file").unwrap_or("manifold.json"));
|
||||
if arguments.occurrences_of("make-config") > 0 {
|
||||
|
|
@ -122,7 +121,7 @@ pub async fn prepare_client(arguments: ArgMatches<'_>, mut framework: StandardFr
|
|||
framework.group_add(&CORE_GROUP);
|
||||
|
||||
let client = Client::builder(&token)
|
||||
.event_handler(Handler::new())
|
||||
.event_handler(event_handler)
|
||||
.framework(framework)
|
||||
.await
|
||||
.expect("Error creating client!");
|
||||
|
|
|
|||
Loading…
Reference in New Issue