feat: Login Discord (email + password)

This commit is contained in:
March 7th
2022-11-08 23:56:17 +07:00
parent 6255db8aa2
commit f5de4de7c0
6 changed files with 75 additions and 13 deletions

View File

@@ -33,17 +33,15 @@ class SessionManager extends CachedManager {
/**
* Logout the client (remote).
* @param {string} password User's password
* @param {string | null} mfaCode MFA code (if 2FA is enabled)
* @returns {Promise<undefined>}
*/
logoutAllDevices(password, mfaCode) {
password = password || this.client.password;
if (!password || typeof password !== 'string') throw new Error('REQUIRE_PASSWORD');
logoutAllDevices(mfaCode) {
if (typeof this.client.password !== 'string') throw new Error('REQUIRE_PASSWORD');
return this.client.api.auth.sessions.logout({
data: {
session_id_hashes: this.cache.map(session => session.id),
password,
password: this.client.password,
code: typeof mfaCode === 'string' ? mfaCode : undefined,
},
});