-
-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathachievement.rs
36 lines (33 loc) · 909 Bytes
/
achievement.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use napi_derive::napi;
#[napi]
pub mod achievement {
#[napi]
pub fn activate(achievement: String) -> bool {
let client = crate::client::get_client();
client
.user_stats()
.achievement(&achievement)
.set()
.and_then(|_| client.user_stats().store_stats())
.is_ok()
}
#[napi]
pub fn is_activated(achievement: String) -> bool {
let client = crate::client::get_client();
client
.user_stats()
.achievement(&achievement)
.get()
.unwrap_or(false)
}
#[napi]
pub fn clear(achievement: String) -> bool {
let client = crate::client::get_client();
client
.user_stats()
.achievement(&achievement)
.clear()
.and_then(|_| client.user_stats().store_stats())
.is_ok()
}
}