mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
chore: make requested changes (#7000)
This commit is contained in:
@@ -5,6 +5,13 @@ const Team = require('./Team');
|
||||
const Application = require('./interfaces/Application');
|
||||
const ApplicationCommandManager = require('../managers/ApplicationCommandManager');
|
||||
const ApplicationFlagsBitField = require('../util/ApplicationFlagsBitField');
|
||||
const PermissionsBitField = require('../util/PermissionsBitField');
|
||||
|
||||
/**
|
||||
* @typedef {Object} ClientApplicationInstallParams
|
||||
* @property {OAuth2Scopes[]} scopes The scopes to add the application to the server with
|
||||
* @property {Readonly<PermissionsBitField>} permissions The permissions this bot will request upon joining
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a Client OAuth2 Application.
|
||||
@@ -24,6 +31,35 @@ class ClientApplication extends Application {
|
||||
_patch(data) {
|
||||
super._patch(data);
|
||||
|
||||
/**
|
||||
* The tags this application has (max of 5)
|
||||
* @type {string[]}
|
||||
*/
|
||||
this.tags = data.tags ?? [];
|
||||
|
||||
if ('install_params' in data) {
|
||||
/**
|
||||
* Settings for this application's default in-app authorization
|
||||
* @type {?ClientApplicationInstallParams}
|
||||
*/
|
||||
this.installParams = {
|
||||
scopes: data.install_params.scopes,
|
||||
permissions: new PermissionsBitField(data.install_params.permissions).freeze(),
|
||||
};
|
||||
} else {
|
||||
this.installParams ??= null;
|
||||
}
|
||||
|
||||
if ('custom_install_url' in data) {
|
||||
/**
|
||||
* This application's custom installation URL
|
||||
* @type {?string}
|
||||
*/
|
||||
this.customInstallURL = data.custom_install_url;
|
||||
} else {
|
||||
this.customInstallURL = null;
|
||||
}
|
||||
|
||||
if ('flags' in data) {
|
||||
/**
|
||||
* The flags this application has
|
||||
|
||||
8
packages/discord.js/typings/index.d.ts
vendored
8
packages/discord.js/typings/index.d.ts
vendored
@@ -756,6 +756,9 @@ export class ClientApplication extends Application {
|
||||
public commands: ApplicationCommandManager;
|
||||
public cover: string | null;
|
||||
public flags: Readonly<ApplicationFlagsBitField>;
|
||||
public tags: string[];
|
||||
public installParams: ClientApplicationInstallParams | null;
|
||||
public customInstallURL: string | null;
|
||||
public owner: User | Team | null;
|
||||
public get partial(): boolean;
|
||||
public rpcOrigins: string[];
|
||||
@@ -5261,6 +5264,11 @@ export interface WelcomeScreenEditData {
|
||||
welcomeChannels?: WelcomeChannelData[];
|
||||
}
|
||||
|
||||
export interface ClientApplicationInstallParams {
|
||||
scopes: OAuth2Scopes[];
|
||||
permissions: Readonly<PermissionsBitField>;
|
||||
}
|
||||
|
||||
export type Serialized<T> = T extends symbol | bigint | (() => any)
|
||||
? never
|
||||
: T extends number | string | boolean | undefined
|
||||
|
||||
Reference in New Issue
Block a user