patched discord rpc for refresh token

This commit is contained in:
GW_MC
2026-01-23 18:02:03 +08:00
parent 4e246637fb
commit b972f10e60
4 changed files with 59 additions and 4 deletions

View File

@@ -0,0 +1,27 @@
diff --git a/src/client.js b/src/client.js
index 0ff29daa9ac1cd4f406944b3e195738d520b2c57..90ef5dc7228e8b1678f72e2573b42bd222a527c1 100644
--- a/src/client.js
+++ b/src/client.js
@@ -32,6 +32,8 @@ class RPCClient extends EventEmitter {
this.options = options;
this.accessToken = null;
+ this.refreshToken = null;
+ this.accessTokenExpiresAt = null;
this.clientId = null;
/**
@@ -222,6 +224,13 @@ class RPCClient extends EventEmitter {
}),
});
+ const {
+ access_token, refresh_token, expires_in
+ } = response;
+
+ this.refreshToken = refresh_token;
+ this.accessTokenExpiresAt = Date.now() + (expires_in * 1000);
+
return response.access_token;
}