Merge pull request #1662 from ZyGout/fix-SessionManager

fix(SessionManager): SessionManager.fetch() returning an empty SessionManager
This commit is contained in:
Elysia
2025-07-11 23:23:05 +07:00
committed by GitHub

View File

@@ -19,22 +19,21 @@ class SessionManager extends CachedManager {
/** /**
* Fetch all sessions of the client. * Fetch all sessions of the client.
* @returns {Promise<SessionManager>} * @returns {Promise<Collection<string, Session>>}
*/ */
fetch() { fetch() {
return new Promise((resolve, reject) => { return this.client.api.auth.sessions
this.client.api.auth.sessions .get()
.get() .then(data => {
.then(data => { const allData = data.user_sessions;
const allData = data.user_sessions;
this.cache.clear(); this.cache.clear();
for (const session of allData) { for (const session of allData) {
this._add(new Session(this.client, session), true, { id: session.id_hash }); this._add(session, true, { id: session.id_hash });
} }
resolve(this);
}) return this.cache;
.catch(reject); });
});
} }
/** /**