fix(ClientUser): Method (require nitro) not work
This commit is contained in:
@@ -5,7 +5,7 @@ const Invite = require('./Invite');
|
||||
const { Message } = require('./Message');
|
||||
const User = require('./User');
|
||||
const { Util } = require('..');
|
||||
const { HypeSquadOptions, Opcodes, NitroType } = require('../util/Constants');
|
||||
const { Opcodes, NitroType, HypeSquadType } = require('../util/Constants');
|
||||
const DataResolver = require('../util/DataResolver');
|
||||
const PurchasedFlags = require('../util/PurchasedFlags');
|
||||
/**
|
||||
@@ -43,7 +43,7 @@ class ClientUser extends User {
|
||||
* Nitro type of the client user.
|
||||
* @type {NitroType}
|
||||
*/
|
||||
this.nitroType = nitro ?? `UNKNOWN`;
|
||||
this.nitroType = nitro ?? `UNKNOWN_${data.premium_type}`;
|
||||
}
|
||||
if ('purchased_flags' in data) {
|
||||
/**
|
||||
@@ -172,7 +172,7 @@ class ClientUser extends User {
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setBanner(banner) {
|
||||
if (this.nitroType !== 2) {
|
||||
if (this.nitroType !== 'NITRO_BOOST') {
|
||||
throw new Error('You must be a Nitro Boosted User to change your banner.');
|
||||
}
|
||||
return this.edit({ banner });
|
||||
@@ -180,7 +180,7 @@ class ClientUser extends User {
|
||||
|
||||
/**
|
||||
* Set HyperSquad House
|
||||
* @param {HypeSquadOptions<number|string>} type
|
||||
* @param {HypeSquadType} type
|
||||
* * `LEAVE`: 0
|
||||
* * `HOUSE_BRAVERY`: 1
|
||||
* * `HOUSE_BRILLIANCE`: 2
|
||||
@@ -193,7 +193,7 @@ class ClientUser extends User {
|
||||
* client.user.setHypeSquad(0);
|
||||
*/
|
||||
async setHypeSquad(type) {
|
||||
const id = typeof type === 'string' ? HypeSquadOptions[type] : type;
|
||||
const id = typeof type === 'string' ? HypeSquadType[type] : type;
|
||||
if (!id && id !== 0) throw new Error('Invalid HypeSquad type.');
|
||||
if (id !== 0) {
|
||||
const data = await this.client.api.hypesquad.online.post({
|
||||
@@ -222,7 +222,8 @@ class ClientUser extends User {
|
||||
* @returns {Promise}
|
||||
*/
|
||||
setDiscriminator(discriminator, password) {
|
||||
if (!this.nitro) throw new Error('You must be a Nitro User to change your discriminator.');
|
||||
if (this.nitroType == 'NONE')
|
||||
throw new Error('You must be a Nitro User to change your discriminator.');
|
||||
if (!password && !this.client.password) {
|
||||
throw new Error('A password is required to change a discriminator.');
|
||||
}
|
||||
|
@@ -398,6 +398,15 @@ class TextBasedChannel {
|
||||
* @param {string} commandName Command name
|
||||
* @param {...?string|string[]} args Command arguments
|
||||
* @returns {Promise<InteractionResponseBody>}
|
||||
* @example
|
||||
* // Send Slash to this channel
|
||||
* // Demo:
|
||||
* // + BotID: "123456789012345678"
|
||||
* // + CommandName: "embed"
|
||||
* // + Args: "title", "description", "author", 'color' (Optional)
|
||||
* channel.sendSlash('123456789012345678', 'embed', 'title', 'description', 'author', '#00ff00')
|
||||
* // Send embed with Title and Color:
|
||||
* channel.sendSlash('123456789012345678', 'embed', 'title', undefined, undefined, '#00ff00')
|
||||
*/
|
||||
async sendSlash(botId, commandName, ...args) {
|
||||
args = args.flat(2);
|
||||
|
@@ -59,6 +59,16 @@ exports.stickerAnimationMode = createEnum(['ALWAYS', 'INTERACTION', 'NEVER']);
|
||||
*/
|
||||
exports.NitroType = createEnum(['NONE', 'NITRO_CLASSIC', 'NITRO_BOOST']);
|
||||
|
||||
/**
|
||||
* All available HypeSquad types:
|
||||
* * `LEAVE` - None
|
||||
* * `HOUSE_BRAVERY` - HypeSquad Bravery
|
||||
* * `HOUSE_BRILLIANCE` - HypeSquad Brilliance
|
||||
* * `HOUSE_BALANCE` - HypeSquad Balance
|
||||
* @typedef {string} HypeSquadType
|
||||
*/
|
||||
exports.HypeSquadType = createEnum(['LEAVE', 'HOUSE_BRAVERY', 'HOUSE_BRILLIANCE', 'HOUSE_BALANCE']);
|
||||
|
||||
exports.localeObject = {
|
||||
da: 'DANISH',
|
||||
de: 'GERMAN',
|
||||
@@ -1584,8 +1594,6 @@ exports.GuildScheduledEventEntityTypes = createEnum([null, 'STAGE_INSTANCE', 'VO
|
||||
*/
|
||||
exports.VideoQualityModes = createEnum([null, 'AUTO', 'FULL']);
|
||||
|
||||
exports.HypeSquadOptions = createEnum(['LEAVE', 'HOUSE_BRAVERY', 'HOUSE_BRILLIANCE', 'HOUSE_BALANCE']);
|
||||
|
||||
exports._cleanupSymbol = Symbol('djsCleanup');
|
||||
|
||||
function keyMirror(arr) {
|
||||
|
Reference in New Issue
Block a user