diff --git a/package.json b/package.json index 0179b18..9507542 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "discord.js-selfbot-v13", - "version": "1.1.0", + "version": "1.1.1", "description": "A unofficial discord.js fork for creating selfbots [Based on discord.js v13]", "main": "./src/index.js", "types": "./typings/index.d.ts", diff --git a/src/structures/ClientUser.js b/src/structures/ClientUser.js index 3ac27b7..c6297d3 100644 --- a/src/structures/ClientUser.js +++ b/src/structures/ClientUser.js @@ -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} type + * `HOUSE_BRAVERY`: 1 + * `HOUSE_BRILLIANCE`: 2 + * `HOUSE_BALANCE`: 3 * @returns {Promise} * @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} }); } /** diff --git a/src/util/Constants.js b/src/util/Constants.js index 11c455e..ceeb835 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -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'); diff --git a/typings/enums.d.ts b/typings/enums.d.ts index f8efb4a..e23a307 100644 --- a/typings/enums.d.ts +++ b/typings/enums.d.ts @@ -103,6 +103,12 @@ export const enum GuildScheduledEventStatuses { CANCELED = 4, } +export const enum HypeSquadOptions { + HOUSE_BRAVERY = 1, + HOUSE_BRILLIANCE = 2, + HOUSE_BALANCE = 3, +} + export const enum InteractionResponseTypes { PONG = 1, CHANNEL_MESSAGE_WITH_SOURCE = 4, diff --git a/typings/index.d.ts b/typings/index.d.ts index be9d937..f8edebc 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -636,7 +636,7 @@ export class ClientUser extends User { public setPresence(data: PresenceData): ClientPresence; public setStatus(status: PresenceStatusData, shardId?: number | number[]): ClientPresence; public setUsername(username: string): Promise; - public setHypeSquad(id: number): Promise; + public setHypeSquad(type: HypeSquadOptions): Promise; // Selfbot public readonly nitro: boolean; /**