fix: listen for voice events
This commit is contained in:
@@ -150,15 +150,25 @@ pub async fn handle(state: State, interaction: Interaction) {
|
||||
state
|
||||
.discord_client
|
||||
.interaction(state.discord_application_id)
|
||||
.update_response(&interaction.token)
|
||||
.embeds(Some(&[EmbedBuilder::new()
|
||||
.create_response(interaction.id, &interaction.token,
|
||||
&InteractionResponse {
|
||||
kind: InteractionResponseType::ChannelMessageWithSource,
|
||||
data: Some(
|
||||
InteractionResponseDataBuilder::new()
|
||||
.embeds([
|
||||
EmbedBuilder::new()
|
||||
.title("Left VC")
|
||||
.description(format!(
|
||||
"This bot left {channel_mention} (and is thereby unable to record anymore)."
|
||||
))
|
||||
.validate()
|
||||
.unwrap()
|
||||
.build()]))
|
||||
.build()
|
||||
])
|
||||
.flags(MessageFlags::EPHEMERAL)
|
||||
.build(),
|
||||
),
|
||||
},)
|
||||
.await
|
||||
.expect("TODO");
|
||||
}
|
||||
|
||||
@@ -212,7 +212,10 @@ async fn main() -> Result<(), MainError> {
|
||||
|
||||
#[tracing::instrument(skip(command_router, state))]
|
||||
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
|
||||
.next_event(event_types)
|
||||
|
||||
Reference in New Issue
Block a user