diff options
| author | Zeyla Hellyer <[email protected]> | 2017-09-21 17:00:41 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-09-21 17:00:41 -0700 |
| commit | e6a503409e374277683f76142eace62264ca533d (patch) | |
| tree | fff8e976ead3be463d0e3817a3a4bbc3b7b439d3 /src/framework | |
| parent | Fix a documentation typo (diff) | |
| download | serenity-e6a503409e374277683f76142eace62264ca533d.tar.xz serenity-e6a503409e374277683f76142eace62264ca533d.zip | |
Remove tokio usage
Diffstat (limited to 'src/framework')
| -rw-r--r-- | src/framework/mod.rs | 3 | ||||
| -rw-r--r-- | src/framework/standard/mod.rs | 41 |
2 files changed, 19 insertions, 25 deletions
diff --git a/src/framework/mod.rs b/src/framework/mod.rs index 678b5dc..0641ab6 100644 --- a/src/framework/mod.rs +++ b/src/framework/mod.rs @@ -62,7 +62,6 @@ pub use self::standard::StandardFramework; use client::Context; use model::Message; -use tokio_core::reactor::Handle; #[cfg(feature = "standard_framework")] use model::UserId; @@ -75,7 +74,7 @@ use model::UserId; /// Note that you may see some other methods in here as well, but they're meant to be internal only /// for the builtin framework. pub trait Framework { - fn dispatch(&mut self, Context, Message, &Handle); + fn dispatch(&mut self, Context, Message); #[cfg(feature = "standard_framework")] fn update_current_user(&mut self, UserId, bool) {} diff --git a/src/framework/standard/mod.rs b/src/framework/standard/mod.rs index 913a1c5..17e2fdd 100644 --- a/src/framework/standard/mod.rs +++ b/src/framework/standard/mod.rs @@ -24,7 +24,6 @@ use client::Context; use super::Framework; use model::{ChannelId, GuildId, Message, UserId}; use model::permissions::Permissions; -use tokio_core::reactor::Handle; use internal::RwLockExt; #[cfg(feature = "cache")] @@ -831,7 +830,7 @@ impl StandardFramework { } impl Framework for StandardFramework { - fn dispatch(&mut self, mut context: Context, message: Message, tokio_handle: &Handle) { + fn dispatch(&mut self, mut context: Context, message: Message) { let res = command::positions(&mut context, &message, &self.configuration); let positions = match res { @@ -927,31 +926,27 @@ impl Framework for StandardFramework { return; } - tokio_handle.spawn_fn(move || { - if let Some(before) = before { - if !(before)(&mut context, &message, &built) { - return Ok(()); - } + if let Some(before) = before { + if !(before)(&mut context, &message, &built) { + return; } + } - let result = match command.exec { - CommandType::StringResponse(ref x) => { - let _ = message.channel_id.say(x); - - Ok(()) - }, - CommandType::Basic(ref x) => (x)(&mut context, &message, args), - CommandType::WithCommands(ref x) => { - (x)(&mut context, &message, groups, args) - }, - }; + let result = match command.exec { + CommandType::StringResponse(ref x) => { + let _ = message.channel_id.say(x); - if let Some(after) = after { - (after)(&mut context, &message, &built, result); - } + Ok(()) + }, + CommandType::Basic(ref x) => (x)(&mut context, &message, args), + CommandType::WithCommands(ref x) => { + (x)(&mut context, &message, groups, args) + }, + }; - Ok(()) - }); + if let Some(after) = after { + (after)(&mut context, &message, &built, result); + } return; } |