From 258ae5f5e5104eccbb3043bea7f4fad164d71118 Mon Sep 17 00:00:00 2001 From: David Thomas Date: Fri, 1 Mar 2024 10:44:08 +0000 Subject: [PATCH] Remove impl AsRef to match serenity@next --- examples/basic_structure/main.rs | 3 ++- src/builtins/register.rs | 4 ++-- src/modal.rs | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/basic_structure/main.rs b/examples/basic_structure/main.rs index 5d4d200477fb..65af59d3dfe2 100644 --- a/examples/basic_structure/main.rs +++ b/examples/basic_structure/main.rs @@ -97,7 +97,8 @@ async fn main() { .setup(move |ctx, _ready, framework| { Box::pin(async move { println!("Logged in as {}", _ready.user.name); - poise::builtins::register_globally(ctx, &framework.options().commands).await?; + let commands = &framework.options().commands; + poise::builtins::register_globally(&ctx.http, commands).await?; Ok(Data { votes: Mutex::new(HashMap::new()), }) diff --git a/src/builtins/register.rs b/src/builtins/register.rs index 8caa9a2f2b1b..3224d49e0f96 100644 --- a/src/builtins/register.rs +++ b/src/builtins/register.rs @@ -50,7 +50,7 @@ pub fn create_application_commands( /// Thin wrapper around [`create_application_commands`] that funnels the returned builder into /// [`serenity::Command::set_global_commands`]. pub async fn register_globally( - http: impl AsRef, + http: &serenity::Http, commands: &[crate::Command], ) -> Result<(), serenity::Error> { let builder = create_application_commands(commands); @@ -63,7 +63,7 @@ pub async fn register_globally( /// Thin wrapper around [`create_application_commands`] that funnels the returned builder into /// [`serenity::GuildId::set_commands`]. pub async fn register_in_guild( - http: impl AsRef, + http: &serenity::Http, commands: &[crate::Command], guild_id: serenity::GuildId, ) -> Result<(), serenity::Error> { diff --git a/src/modal.rs b/src/modal.rs index 8d9269be7973..d1edeb69f8e2 100644 --- a/src/modal.rs +++ b/src/modal.rs @@ -120,14 +120,14 @@ pub async fn execute_modal( /// If you need more specialized behavior, you can copy paste the implementation of this function /// and adjust to your needs. The code of this function is just a starting point. pub async fn execute_modal_on_component_interaction( - ctx: impl AsRef, + ctx: &serenity::Context, interaction: serenity::ComponentInteraction, defaults: Option, timeout: Option, ) -> Result, serenity::Error> { execute_modal_generic( - ctx.as_ref(), - |resp| interaction.create_response(ctx.as_ref(), resp), + ctx, + |resp| interaction.create_response(ctx, resp), interaction.id.to_string(), defaults, timeout,