fix: listen for voice events

This commit is contained in:
2026-04-10 00:53:23 -04:00
parent 7885526944
commit dfda319ab4
2 changed files with 17 additions and 4 deletions

View File

@@ -150,15 +150,25 @@ pub async fn handle(state: State, interaction: Interaction) {
state state
.discord_client .discord_client
.interaction(state.discord_application_id) .interaction(state.discord_application_id)
.update_response(&interaction.token) .create_response(interaction.id, &interaction.token,
.embeds(Some(&[EmbedBuilder::new() &InteractionResponse {
kind: InteractionResponseType::ChannelMessageWithSource,
data: Some(
InteractionResponseDataBuilder::new()
.embeds([
EmbedBuilder::new()
.title("Left VC") .title("Left VC")
.description(format!( .description(format!(
"This bot left {channel_mention} (and is thereby unable to record anymore)." "This bot left {channel_mention} (and is thereby unable to record anymore)."
)) ))
.validate() .validate()
.unwrap() .unwrap()
.build()])) .build()
])
.flags(MessageFlags::EPHEMERAL)
.build(),
),
},)
.await .await
.expect("TODO"); .expect("TODO");
} }

View File

@@ -212,7 +212,10 @@ async fn main() -> Result<(), MainError> {
#[tracing::instrument(skip(command_router, state))] #[tracing::instrument(skip(command_router, state))]
async fn handle_events(command_router: Arc<CommandRouter>, state: State, mut shard: Shard) { async fn handle_events(command_router: Arc<CommandRouter>, state: State, mut shard: Shard) {
let event_types = EventTypeFlags::GUILD_VOICE_STATES | EventTypeFlags::INTERACTION_CREATE; let event_types = EventTypeFlags::GUILD_VOICE_STATES
| EventTypeFlags::INTERACTION_CREATE
| EventTypeFlags::VOICE_SERVER_UPDATE
| EventTypeFlags::VOICE_STATE_UPDATE;
while let Some(Some(event_res)) = shard while let Some(Some(event_res)) = shard
.next_event(event_types) .next_event(event_types)