Added ephemeral responses

This commit is contained in:
2024-12-18 12:59:54 -05:00
parent a274d30521
commit 56e44442e4
13 changed files with 121 additions and 61 deletions

View File

@@ -1,10 +1,6 @@
use std::sync::Arc;
use reqwest::Url;
use serenity::all::{
CommandInteraction, CreateInteractionResponse, CreateInteractionResponseMessage,
EditInteractionResponse,
};
use serenity::client::Cache;
use serenity::model::prelude::{GuildId, ChannelId};
use serenity::model::user::User;
@@ -55,31 +51,6 @@ pub async fn leave_voice_channel(manager: &Arc<Songbird>, guild_id: &GuildId) ->
Ok(())
}
pub async fn process_message(ctx: &Context, command: &CommandInteraction) {
create_response(&ctx, &command, format!("Processing...")).await;
}
pub async fn create_response(ctx: &Context, command: &CommandInteraction, content: String) {
let data = CreateInteractionResponseMessage::new().content(content.to_owned());
let builder = CreateInteractionResponse::Message(data);
match command.create_response(&ctx.http, builder).await {
Ok(_) => {}
Err(err) => {
log::error!("Failed to create response for {content}\n{err}");
}
};
}
pub async fn edit_response(ctx: &Context, command: &CommandInteraction, content: String) {
let builder = EditInteractionResponse::new().content(content.to_owned());
match command.edit_response(&ctx.http, builder).await {
Ok(_) => {}
Err(err) => {
log::error!("Failed to create response for {content}\n{err}");
}
}
}
/**
* Checks if a URL is valid and if it is a playlist.
* 1st tuple value is if the URL is valid.