diff --git a/src/structures/ClientUser.js b/src/structures/ClientUser.js index 510e314..6cc15ef 100644 --- a/src/structures/ClientUser.js +++ b/src/structures/ClientUser.js @@ -142,6 +142,7 @@ class ClientUser extends User { /** * Set HyperSquad House * @param {HypeSquadOptions} type + * `LEAVE`: 0 * `HOUSE_BRAVERY`: 1 * `HOUSE_BRILLIANCE`: 2 * `HOUSE_BALANCE`: 3 @@ -149,13 +150,16 @@ class ClientUser extends User { * @example * // Set HyperSquad HOUSE_BRAVERY * client.user.setHypeSquad(1); || client.user.setHypeSquad('HOUSE_BRAVERY'); + * // Leave + * client.user.setHypeSquad(0); */ async setHypeSquad(type) { const id = typeof type === 'string' ? HypeSquadOptions[type] : type; - if (!id) throw new Error('Invalid HypeSquad type.'); - return await this.client.api.hypesquad.online.post({ + if (!id && id !== 0) throw new Error('Invalid HypeSquad type.'); + if (id !== 0) return await this.client.api.hypesquad.online.post({ data: { house_id: id }, }); + else return await this.client.api.hypesquad.online.delete(); } /** diff --git a/src/util/Constants.js b/src/util/Constants.js index cecf8f5..1cd4736 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -1327,7 +1327,7 @@ exports.GuildScheduledEventStatuses = createEnum([null, 'SCHEDULED', 'ACTIVE', ' */ exports.GuildScheduledEventEntityTypes = createEnum([null, 'STAGE_INSTANCE', 'VOICE', 'EXTERNAL']); /* eslint-enable max-len */ -exports.HypeSquadOptions = createEnum([null, 'HOUSE_BRAVERY', 'HOUSE_BRILLIANCE', 'HOUSE_BALANCE']); +exports.HypeSquadOptions = createEnum(['LEAVE', 'HOUSE_BRAVERY', 'HOUSE_BRILLIANCE', 'HOUSE_BALANCE']); exports._cleanupSymbol = Symbol('djsCleanup');