diff --git a/src/commands/edit/message_ops.rs b/src/commands/edit/message_ops.rs index 017a3a77..d3456b4f 100644 --- a/src/commands/edit/message_ops.rs +++ b/src/commands/edit/message_ops.rs @@ -1,10 +1,10 @@ use crate::config::Config; -use crate::db::messages::{get_thread_message_by_inbox_message_id, MessageIds}; +use crate::db::messages::{MessageIds, get_thread_message_by_inbox_message_id}; use crate::db::operations::{ get_message_ids_by_number, get_thread_by_channel_id, get_user_id_from_channel_id, }; -use crate::errors::common::{incorrect_message_id, not_found, permission_denied, thread_not_found}; use crate::errors::MessageError::{DmAccessFailed, EditFailed}; +use crate::errors::common::{incorrect_message_id, not_found, permission_denied, thread_not_found}; use crate::errors::{ModmailError, ModmailResult}; use crate::utils::conversion::hex_string_to_int::hex_string_to_int; use crate::utils::message::message_builder::MessageBuilder; diff --git a/src/commands/move_thread/slash_command/move_thread.rs b/src/commands/move_thread/slash_command/move_thread.rs index 44e73ae0..24c1efd6 100644 --- a/src/commands/move_thread/slash_command/move_thread.rs +++ b/src/commands/move_thread/slash_command/move_thread.rs @@ -11,7 +11,7 @@ use crate::utils::command::defer_response::defer_response; use crate::utils::message::message_builder::MessageBuilder; use serenity::all::{ CommandInteraction, CommandOptionType, Context, CreateCommand, CreateCommandOption, - CreateInteractionResponse, ResolvedOption, + ResolvedOption, }; use std::collections::HashMap; @@ -109,12 +109,10 @@ pub async fn run( ) .await .to_channel(command.channel_id) - .build_interaction_message() + .build_interaction_message_followup() .await; - command - .create_response(&ctx.http, CreateInteractionResponse::Message(response)) - .await?; + command.create_followup(&ctx.http, response).await?; Ok(()) } diff --git a/src/errors/handler.rs b/src/errors/handler.rs index 24eaf755..4f3c71b7 100644 --- a/src/errors/handler.rs +++ b/src/errors/handler.rs @@ -3,10 +3,9 @@ use crate::errors::dictionary::DictionaryManager; use crate::errors::types::{ModmailError, ModmailResult}; use crate::i18n::languages::{Language, LanguageDetector, LanguagePreferences}; use serenity::all::{ - ChannelId, Colour, CommandInteraction, Context, CreateEmbed, CreateInteractionResponseMessage, + ChannelId, Colour, CommandInteraction, Context, CreateEmbed, CreateInteractionResponseFollowup, CreateMessage, Message, UserId, }; -use serenity::builder::CreateInteractionResponse; use std::collections::HashMap; use std::sync::Arc; use tokio::sync::RwLock; @@ -154,7 +153,7 @@ impl ErrorHandler { ctx: &Context, command: &CommandInteraction, error: &ModmailError, - ) -> Result<(), serenity::Error> { + ) -> Result { let formatted_error = self .handle_error( error, @@ -166,11 +165,9 @@ impl ErrorHandler { let embed = self.create_error_embed(&formatted_error).await; command - .create_response( + .create_followup( &ctx.http, - CreateInteractionResponse::Message( - CreateInteractionResponseMessage::new().embed(embed), - ), + CreateInteractionResponseFollowup::new().embed(embed), ) .await }