fix: listen for voice events
This commit is contained in:
@@ -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");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user