HypeSquad

Created by catcat1204
Edited by aiko-chan-ai
This commit is contained in:
March 7th
2022-03-25 23:56:20 +07:00
parent 7250fa2dbd
commit a39bc31b58
5 changed files with 20 additions and 7 deletions

View File

@@ -2,6 +2,7 @@
const User = require('./User');
const DataResolver = require('../util/DataResolver');
const { HypeSquadOptions } = require('../util/Constants');
/**
* Represents the logged in client's Discord user.
@@ -108,14 +109,19 @@ class ClientUser extends User {
}
/**
* Set HyperSquad House
* @param {number} id
* @param {HypeSquadOptions<Number|String>} type
* `HOUSE_BRAVERY`: 1
* `HOUSE_BRILLIANCE`: 2
* `HOUSE_BALANCE`: 3
* @returns {Promise<void>}
* @example
* // Set HyperSquad House
* client.user.setHyperSquadHouse(1);
* // Set HyperSquad HOUSE_BRAVERY
* client.user.setHypeSquad(1); || client.user.setHypeSquad('HOUSE_BRAVERY');
*/
setHypeSquad(id) {
this.client.api.hypesquad.online.post({ data: {house_id: id} });
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({ data: {house_id: id} });
}
/**

View File

@@ -1183,6 +1183,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._cleanupSymbol = Symbol('djsCleanup');