diff options
| author | Alex Lyon <[email protected]> | 2017-07-13 21:30:00 -0700 |
|---|---|---|
| committer | alex <[email protected]> | 2017-07-14 06:30:00 +0200 |
| commit | 88765d0a978001ff88a1ee12798a725b7f5a90e9 (patch) | |
| tree | d66970df218ac9e9c4aa3b038e56ee6ce7c81292 /src/framework | |
| parent | Fix the doc on `PrivateChannel::name` (diff) | |
| download | serenity-88765d0a978001ff88a1ee12798a725b7f5a90e9.tar.xz serenity-88765d0a978001ff88a1ee12798a725b7f5a90e9.zip | |
Switch to tokio for events (#122)
Diffstat (limited to 'src/framework')
| -rw-r--r-- | src/framework/mod.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/framework/mod.rs b/src/framework/mod.rs index cb65682..d68691e 100644 --- a/src/framework/mod.rs +++ b/src/framework/mod.rs @@ -73,11 +73,11 @@ use self::command::{AfterHook, BeforeHook}; use std::collections::HashMap; use std::default::Default; use std::sync::Arc; -use std::thread; use ::client::Context; use ::model::{Message, MessageId, UserId, ChannelId, ReactionType}; use ::model::permissions::Permissions; use ::utils; +use tokio_core::reactor::Handle; #[cfg(feature="cache")] use ::client::CACHE; @@ -513,7 +513,7 @@ impl Framework { } #[allow(cyclomatic_complexity)] - pub(crate) fn dispatch(&mut self, mut context: Context, message: Message) { + pub(crate) fn dispatch(&mut self, mut context: Context, message: Message, tokio_handle: &Handle) { let res = command::positions(&mut context, &message, &self.configuration); let positions = match res { @@ -597,10 +597,10 @@ impl Framework { return; } - thread::spawn(move || { + tokio_handle.spawn_fn(move || { if let Some(before) = before { if !(before)(&mut context, &message, &built) { - return; + return Ok(()); } } @@ -621,6 +621,8 @@ impl Framework { if let Some(after) = after { (after)(&mut context, &message, &built, result); } + + Ok(()) }); return; |