use discord_rich_presence::{activity, DiscordIpc, DiscordIpcClient}; use clap::Parser; #[derive(Parser)] #[command(author, version, about, long_about = None)] struct ClapCli { #[arg(short = 'c', long = "client-id")] client_id: Option, #[arg(short = 's', long = "state")] state: Option, #[arg(short = 'd', long = "details")] details: Option, #[arg(short = 'K', long = "large-image-key")] large_image_key: Option, #[arg(short = 'T', long = "large-image-text")] large_image_text: Option, #[arg(short = 'k', long = "small-image-key")] small_image_key: Option, #[arg(short = 't', long = "small-image-text")] small_image_text: Option } fn main() { let args = ClapCli::parse(); let mut client = match DiscordIpcClient::new( &args.client_id.unwrap_or("1191646640000487476".to_string()) ) { Ok(c) => { println!("[OK] Connected to application."); c }, Err(er) => { println!("[ER] {}", er.to_string()); std::process::exit(2); } }; match client.connect() { Err(er) => { println!("[ER] {}", er.to_string()); std::process::exit(2); }, Ok(_) => println!("[OK] Connected to your Discord client.") }; match client.set_activity(activity::Activity::new() .state(&args.state.unwrap_or("memes".to_string())) .details(&args.details.unwrap_or("just memes".to_string())) // .buttons(vec![activity::Button::new( // "A button", // "https://github.com", // )]) .assets( activity::Assets::new() .large_image(&args.large_image_key.unwrap_or("https://i.imgflip.com/3ldvwo.jpg".to_string())) .large_text(&args.large_image_text.unwrap_or("deault juice".to_string())) .small_image(&args.small_image_key.unwrap_or("https://pluspng.com/img-png/meme-png--800.png".to_string())) .small_text(&args.small_image_text.unwrap_or("honk".to_string())) )) { Err(er) => { println!("[ER] {}", er.to_string()); std::process::exit(2); }, Ok(_) => println!("[OK] Activity set.") }; std::thread::park(); match client.close() { Err(er) => { println!("[ER] {}", er.to_string()); std::process::exit(2); }, Ok(_) => println!("[OK] Connection closed.") }; }