Skip to content

Commit

Permalink
0.8.2 - Fix Discord RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
ShayBox committed Oct 7, 2024
1 parent d1c053b commit 55bac32
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 69 deletions.
75 changes: 33 additions & 42 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vrc-log"
version = "0.8.0"
version = "0.8.2"
authors = ["Shayne Hartford <[email protected]>"]
edition = "2021"
description = "VRChat Local Cache Avatar ID Logger"
Expand Down
9 changes: 5 additions & 4 deletions src/discord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ pub fn get_dev_id() -> String {
#[once(option = true, sync_writes = true)]
pub fn get_user_id() -> Option<String> {
let discord = Discord::start();
let user = discord.user.lock().clone();

// block_until_event will never timeout
// block_until_event will never time out
std::thread::sleep(Duration::from_secs(5));
discord.client.shutdown().ok()?;

Some(match user {
let user_id = match discord.user.lock().clone() {
None => get_dev_id(),
Some(user) => {
let userid = user.id.unwrap_or_else(get_dev_id);
Expand All @@ -75,5 +74,7 @@ pub fn get_user_id() -> Option<String> {
userid
}
}
})
};

Some(user_id)
}
10 changes: 4 additions & 6 deletions src/provider/avtrdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,18 @@ impl Provider for AvtrDB {
.send()?;

let status = response.status();
debug!("[{}] {status} | {}", Type::AvtrDB, response.text()?);
let text = response.text()?;
debug!("[{}] {status} | {text}", Type::AVTRDB);

let unique = match status.as_u16() {
200 | 404 => false,
201 => true,
429 => {
warn!("[{}] 429 Rate Limit, Please Wait 1 Minute...", Type::AvtrDB);
warn!("[{}] 429 Rate Limit, Please Wait 1 Minute...", Type::AVTRDB);
std::thread::sleep(Duration::from_secs(60));
self.send_avatar_id(avatar_id)?
}
_ => {
error!("[{}] {status}", Type::AvtrDB);
false
}
_ => bail!("[{}] {status} | {text}", Type::AVTRDB),
};

Ok(unique)
Expand Down
5 changes: 1 addition & 4 deletions src/provider/doughnut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ impl Provider for Doughnut {
let unique = match status.as_u16() {
200 => false,
404 => true,
_ => {
error!("[{}] {status} | {text}", Type::DOUGHNUT);
false
}
_ => bail!("[{}] {status} | {text}", Type::DOUGHNUT),
};

Ok(unique)
Expand Down
5 changes: 1 addition & 4 deletions src/provider/jeff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ impl Provider for Jeff {
let unique = match status.as_u16() {
200 => false,
404 => true,
_ => {
error!("[{}] {status} | {text}", Type::JEFF);
false
}
_ => bail!("[{}] {status} | {text}", Type::JEFF),
};

Ok(unique)
Expand Down
5 changes: 1 addition & 4 deletions src/provider/neko.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ impl Provider for Neko {
let unique = match status.as_u16() {
200 => false,
404 => true,
_ => {
error!("[{}] {status} | {text}", Type::NEKO);
false
}
_ => bail!("[{}] {status} | {text}", Type::NEKO),
};

Ok(unique)
Expand Down
5 changes: 1 addition & 4 deletions src/provider/vrcdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ impl Provider for VRCDB {
debug!("New Avatars can take up to a day to be processed");
true
}
_ => {
error!("[{}] {status} | {text}", Type::VRCDB);
false
}
_ => bail!("[{}] {status} | {text}", Type::VRCDB),
};

Ok(unique)
Expand Down

0 comments on commit 55bac32

Please sign in to comment.