feat: set the global commands

This commit is contained in:
2026-03-24 01:59:57 -04:00
parent 30c4761fe0
commit 67bdc9e451
2 changed files with 34 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
use clap::Parser;
use fomo_reducer::{VCs, initialize_vcs, update_vcs};
use fomo_reducer::{VCs, all_commands, initialize_vcs, update_vcs};
use opendal::{IntoOperatorUri, Operator, OperatorUri};
use secrecy::{ExposeSecret, SecretString};
use snafu::Snafu;
@@ -109,6 +109,38 @@ async fn main() -> Result<(), MainError> {
let mut next_event = shard.next_event(vc_event_types);
let discord_client = twilight_http::Client::new(discord_token.expose_secret().to_owned());
let current_application = discord_client
.current_user_application()
.await
.expect("couldn't get current Discord application"); // TODO
let current_application = current_application
.model()
.await
.expect("couldn't get current Discord application"); // TODO
let application_id = current_application.id;
let interaction_client = discord_client.interaction(application_id);
let commands = all_commands();
let returned_commands = interaction_client
.set_global_commands(
Vec::from_iter(
commands
.iter()
.map(|(command, _handler)| (*command).clone()),
)
.as_slice(),
)
.await
.expect("failed to set interaction commands") // TODO
.models()
.await
.expect("failed to deserialize set commands"); // TODO
let mut voice_status = initialize_vcs(&discord_client).await;
while let Some(event_res) = next_event.await {
match event_res {