2018-04-10 08:26:41 -04:00
|
|
|
extern crate discord_rpc_client;
|
2022-02-03 09:52:53 -05:00
|
|
|
extern crate simplelog;
|
2018-04-10 08:26:41 -04:00
|
|
|
|
2022-02-03 09:52:53 -05:00
|
|
|
use discord_rpc_client::{models::Event, Client as DiscordRPC};
|
2018-04-10 08:26:41 -04:00
|
|
|
use simplelog::*;
|
2022-02-03 09:52:53 -05:00
|
|
|
use std::{thread, time};
|
2018-04-10 08:26:41 -04:00
|
|
|
|
2022-02-03 09:52:53 -05:00
|
|
|
fn main() -> discord_rpc_client::Result<()> {
|
2018-04-10 08:26:41 -04:00
|
|
|
TermLogger::init(LevelFilter::Debug, Config::default()).unwrap();
|
|
|
|
|
2018-12-05 18:58:26 -05:00
|
|
|
let mut drpc = DiscordRPC::new(425407036495495169);
|
2018-04-10 08:26:41 -04:00
|
|
|
|
2022-02-03 09:52:53 -05:00
|
|
|
drpc.connect()?;
|
2018-04-10 08:26:41 -04:00
|
|
|
|
2022-02-03 09:52:53 -05:00
|
|
|
drpc.subscribe(Event::ActivityJoin, |j| j.secret("123456"))
|
2018-04-10 08:26:41 -04:00
|
|
|
.expect("Failed to subscribe to event");
|
|
|
|
|
2022-02-03 09:52:53 -05:00
|
|
|
drpc.subscribe(Event::ActivitySpectate, |s| s.secret("123456"))
|
2018-04-10 08:26:41 -04:00
|
|
|
.expect("Failed to subscribe to event");
|
|
|
|
|
|
|
|
drpc.subscribe(Event::ActivityJoinRequest, |s| s)
|
|
|
|
.expect("Failed to subscribe to event");
|
|
|
|
|
|
|
|
drpc.unsubscribe(Event::ActivityJoinRequest, |j| j)
|
|
|
|
.expect("Failed to unsubscribe from event");
|
|
|
|
|
2022-02-03 09:52:53 -05:00
|
|
|
loop {
|
|
|
|
thread::sleep(time::Duration::from_millis(500));
|
|
|
|
}
|
2018-04-10 08:26:41 -04:00
|
|
|
}
|