mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
feat: app authorization links and tags for v13 (#7731)
This commit is contained in:
@@ -4,6 +4,13 @@ const Team = require('./Team');
|
|||||||
const Application = require('./interfaces/Application');
|
const Application = require('./interfaces/Application');
|
||||||
const ApplicationCommandManager = require('../managers/ApplicationCommandManager');
|
const ApplicationCommandManager = require('../managers/ApplicationCommandManager');
|
||||||
const ApplicationFlags = require('../util/ApplicationFlags');
|
const ApplicationFlags = require('../util/ApplicationFlags');
|
||||||
|
const Permissions = require('../util/Permissions');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @typedef {Object} ClientApplicationInstallParams
|
||||||
|
* @property {InviteScope[]} scopes The scopes to add the application to the server with
|
||||||
|
* @property {Readonly<Permissions>} permissions The permissions this bot will request upon joining
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a Client OAuth2 Application.
|
* Represents a Client OAuth2 Application.
|
||||||
@@ -23,6 +30,35 @@ class ClientApplication extends Application {
|
|||||||
_patch(data) {
|
_patch(data) {
|
||||||
super._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 Permissions(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) {
|
if ('flags' in data) {
|
||||||
/**
|
/**
|
||||||
* The flags this application has
|
* The flags this application has
|
||||||
|
|||||||
8
typings/index.d.ts
vendored
8
typings/index.d.ts
vendored
@@ -634,6 +634,9 @@ export class ClientApplication extends Application {
|
|||||||
public commands: ApplicationCommandManager;
|
public commands: ApplicationCommandManager;
|
||||||
public cover: string | null;
|
public cover: string | null;
|
||||||
public flags: Readonly<ApplicationFlags>;
|
public flags: Readonly<ApplicationFlags>;
|
||||||
|
public tags: string[];
|
||||||
|
public installParams: ClientApplicationInstallParams | null;
|
||||||
|
public customInstallURL: string | null;
|
||||||
public owner: User | Team | null;
|
public owner: User | Team | null;
|
||||||
public readonly partial: boolean;
|
public readonly partial: boolean;
|
||||||
public rpcOrigins: string[];
|
public rpcOrigins: string[];
|
||||||
@@ -3568,6 +3571,11 @@ export type AllowedThreadTypeForNewsChannel = 'GUILD_NEWS_THREAD' | 10;
|
|||||||
|
|
||||||
export type AllowedThreadTypeForTextChannel = 'GUILD_PUBLIC_THREAD' | 'GUILD_PRIVATE_THREAD' | 11 | 12;
|
export type AllowedThreadTypeForTextChannel = 'GUILD_PUBLIC_THREAD' | 'GUILD_PRIVATE_THREAD' | 11 | 12;
|
||||||
|
|
||||||
|
export interface ClientApplicationInstallParams {
|
||||||
|
scopes: InviteScope[];
|
||||||
|
permissions: Readonly<Permissions>;
|
||||||
|
}
|
||||||
|
|
||||||
export interface APIErrors {
|
export interface APIErrors {
|
||||||
UNKNOWN_ACCOUNT: 10001;
|
UNKNOWN_ACCOUNT: 10001;
|
||||||
UNKNOWN_APPLICATION: 10002;
|
UNKNOWN_APPLICATION: 10002;
|
||||||
|
|||||||
Reference in New Issue
Block a user