From 7b3fa9905af370017de29cb363d15e7630887ea0 Mon Sep 17 00:00:00 2001 From: Rafael Bradley Date: Wed, 13 Aug 2025 14:49:12 -0300 Subject: [PATCH] Rename IntoPrefixes into PrefixGetter --- src/framework/bot.rs | 14 +++++++------- src/framework/runtime.rs | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/framework/bot.rs b/src/framework/bot.rs index da2964e..99440e4 100644 --- a/src/framework/bot.rs +++ b/src/framework/bot.rs @@ -28,7 +28,7 @@ pub enum RuntimeError { } #[async_trait] -pub trait IntoPrefixes { +pub trait PrefixGetter { async fn get( &self, runtime: &Runtime, @@ -38,21 +38,21 @@ pub trait IntoPrefixes { } #[async_trait] -impl IntoPrefixes for String { +impl PrefixGetter for String { async fn get(&self, _: &Runtime, _: Option, _: Option) -> Vec { vec![self.to_string()] } } #[async_trait] -impl IntoPrefixes for &str { +impl PrefixGetter for &str { async fn get(&self, _: &Runtime, _: Option, _: Option) -> Vec { vec![self.to_string()] } } #[async_trait] -impl IntoPrefixes for [T; N] +impl PrefixGetter for [T; N] where T: ToString, { @@ -62,7 +62,7 @@ where } #[async_trait] -impl IntoPrefixes for F +impl PrefixGetter for F where F: Fn() -> Fut + Send + Sync + 'static, Fut: Future> + Send, @@ -74,7 +74,7 @@ where pub struct Bot { state: Arc, - prefixes: Arc + Send + Sync>, + prefixes: Arc + Send + Sync>, intents: Intents, commands: Vec>>, components: Vec>>, @@ -90,7 +90,7 @@ pub struct Bot { } impl Bot { - pub fn new(state: T, prefixes: impl IntoPrefixes + Send + Sync + 'static) -> Self { + pub fn new(state: T, prefixes: impl PrefixGetter + Send + Sync + 'static) -> Self { Self { state: Arc::new(state), prefixes: Arc::new(prefixes), diff --git a/src/framework/runtime.rs b/src/framework/runtime.rs index 9416eeb..1382530 100644 --- a/src/framework/runtime.rs +++ b/src/framework/runtime.rs @@ -23,7 +23,7 @@ use twilight_http::Client; use twilight_model::oauth::Application; use crate::framework::{ - bot::IntoPrefixes, commands::Command, interactions::registry::ComponentRegistry, + bot::PrefixGetter, commands::Command, interactions::registry::ComponentRegistry, }; /// The application's runtime tools. @@ -38,7 +38,7 @@ pub struct Runtime { pub registry: ComponentRegistry, /// The command prefixes getter. - pub prefixes: Arc + Send + Sync + 'static>, + pub prefixes: Arc + Send + Sync + 'static>, /// The commands available in the application. pub commands: Vec>>,