aboutsummaryrefslogtreecommitdiff
path: root/src/framework
diff options
context:
space:
mode:
Diffstat (limited to 'src/framework')
-rw-r--r--src/framework/mod.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/framework/mod.rs b/src/framework/mod.rs
index 98f7d40..c95c160 100644
--- a/src/framework/mod.rs
+++ b/src/framework/mod.rs
@@ -888,7 +888,7 @@ impl BuiltinFramework {
}
}
-impl ::Framework for BuiltinFramework {
+impl Framework for BuiltinFramework {
fn dispatch(&mut self, mut context: Context, message: Message, tokio_handle: &Handle) {
let res = command::positions(&mut context, &message, &self.configuration);
@@ -1025,3 +1025,20 @@ impl ::Framework for BuiltinFramework {
#[cfg(feature = "builtin_framework")]
fn initialized(&self) -> bool { self.initialized }
}
+
+/// This trait allows for serenity to either use its builtin framework, or yours.
+///
+/// When implementing, be sure to use `tokio_handle.spawn_fn(|| ...; Ok())` when dispatching
+/// commands.
+///
+/// Note that you may see some other methods in here as well, but they're meant to be internal only
+/// for the builtin framework.
+#[cfg(feature = "framework")]
+pub trait Framework {
+ fn dispatch(&mut self, Context, Message, &Handle);
+
+ #[cfg(feature = "builtin_framework")]
+ fn update_current_user(&mut self, UserId, bool) {}
+ #[cfg(feature = "builtin_framework")]
+ fn initialized(&self) -> bool { false }
+}