OneLauncher-Cracked/packages/core/examples/discord.rs
2025-04-02 17:43:59 +02:00

25 lines
No EOL
724 B
Rust

use onelauncher_core::{api::proxy::proxy_empty::ProxyEmpty, error::LauncherResult, initialize_core, store::State};
#[tokio::main]
async fn main() -> LauncherResult<()> {
initialize_core(ProxyEmpty::new()).await?;
let state = State::get().await?;
let Some(rpc) = &state.rpc else {
println!("RPC is not initialized");
return Ok(());
};
rpc.set_message("Hello, Discord!").await;
println!("Set Discord message");
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
rpc.set_message("This user is testing Discord RPC!").await;
println!("Set Discord message");
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
rpc.clear_activity().await;
println!("Cleared Discord message");
Ok(())
}