1use anyhow::Result;
2use std::time::Duration;
3
4use filthy_rich::DiscordIPC;
5use tokio::time::sleep;
6
7#[tokio::main]
8async fn main() -> Result<()> {
9 let mut client = DiscordIPC::new("1463450870480900160")
10 .on_ready(|| println!("filthy-rich is READY to set activities."));
11
12 client.run(true).await?;
14
15 client
16 .set_activity("this runs".to_string(), Some("for ten seconds".to_string()))
17 .await?;
18 sleep(Duration::from_secs(5)).await;
19 client
20 .set_activity("believe it".to_string(), Some("or not!".to_string()))
21 .await?;
22 sleep(Duration::from_secs(5)).await;
23
24 client.close().await?;
25 sleep(Duration::from_secs(5)).await;
26
27 client.run(true).await?;
28
29 client
30 .set_activity("this runs".to_string(), Some("for ten seconds".to_string()))
31 .await?;
32 sleep(Duration::from_secs(5)).await;
33 client
34 .set_activity("believe it".to_string(), Some("or not!".to_string()))
35 .await?;
36 sleep(Duration::from_secs(5)).await;
37
38 Ok(())
39}