feat: basic setup for link slash command

This commit is contained in:
silver 2023-09-17 15:25:17 +01:00
parent 591c61b009
commit 14cbf0bcad
6 changed files with 238 additions and 41 deletions

View file

@ -67,6 +67,7 @@ impl EventHandler for Handler {
async fn interaction_create(&self, ctx: Context, interaction: Interaction) {
if let Interaction::ApplicationCommand(command) = interaction {
let _ = command.defer_ephemeral(&ctx.http).await;
//println!("Received command interaction: {:#?}", command);
let content = match command.data.name.as_str() {
@ -75,10 +76,8 @@ impl EventHandler for Handler {
};
if let Err(why) = command
.create_interaction_response(&ctx.http, |response| {
response
.kind(InteractionResponseType::ChannelMessageWithSource)
.interaction_response_data(|message| message.content(content).ephemeral(true))
.edit_original_interaction_response(&ctx.http, |response| {
response.content(content)
})
.await
{