darkcord
Version:
A NodeJS Package to interact with Discord API
142 lines (141 loc) • 4.75 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClientApplication = exports.Application = void 0;
const Base_1 = require("./Base");
const Team_1 = require("./Team");
class Application extends Base_1.Base {
/**
* The name of the app
*/
name;
/**
* The icon hash of the app
*/
icon;
/**
* The description of the app
*/
description;
/**
* An array of rpc origin urls, if rpc is enabled
*/
rpcOrigins;
/**
* When false only app owner can join the app's bot to guilds
*/
botPublic;
/**
* When true the app's bot will only join upon completion of the full oauth2 code grant flow
*/
botRequireCodeGrant;
/**
* The url of the app's terms of service
*/
termsOfServiceUrl;
/**
* The url of the app's privacy policy
*/
privacyPolicyUrl;
/**
* Partial user object containing info on the owner of the application
*/
owner;
/**
* The hex encoded key for verification in interactions and the GameSDK's GetTicket
*/
verifyKey;
/**
* If the application belongs to a team, this will be a list of the members of that team
*/
team;
/**
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
*/
guildId;
/**
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
*/
primarySkuId;
/**
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
*/
slug;
/**
* The application's default rich presence invite cover image hash
*/
coverImage;
/**
* The application's public flags
*/
flags;
/**
* Up to 5 tags describing the content and functionality of the application
*/
tags;
/**
* Settings for the application's default in-app authorization link, if enabled
*/
installParams;
/**
* The application's default custom authorization link, if enabled
*/
customInstallUrl;
/**
* The application's role connection verification entry point, which when configured will render the app as a verification method in the guild role verification configuration
*/
roleConnectionsVerificationUrl;
constructor(data) {
super(data, data.client);
this.name = data.name;
this.icon = data.icon;
this.description = data.description;
this.rpcOrigins = data.rpc_origins;
this.botPublic = data.bot_public;
this.botRequireCodeGrant = data.bot_require_code_grant;
this.termsOfServiceUrl = data.terms_of_service_url;
this.privacyPolicyUrl = data.privacy_policy_url;
this.owner = data.owner ? this._client.users.add(data.owner) : null;
this.verifyKey = data.verify_key;
this.team = data.team
? new Team_1.Team({ ...data.team, client: data.client })
: null;
this.guildId = data.guild_id;
this.primarySkuId = data.primary_sku_id;
this.slug = data.slug;
this.coverImage = data.cover_image;
this.flags = data.flags;
this.tags = data.tags;
this.installParams = data.install_params;
this.customInstallUrl = data.custom_install_url;
this.roleConnectionsVerificationUrl =
data.role_connections_verification_url;
}
}
exports.Application = Application;
class ClientApplication extends Application {
createCommand(options) {
return this._client.rest.createApplicationCommand(this.id, options);
}
createGuildCommand(guildId, options) {
return this._client.rest.createGuildApplicationCommand(this.id, guildId, options);
}
deleteCommand(commandId) {
return this._client.rest.deleteApplicationCommand(this.id, commandId);
}
deleteGuildCommand(guildId, commandId) {
return this._client.rest.deleteGuildApplicationCommand(this.id, guildId, commandId);
}
editCommand(commandId, options) {
return this._client.rest.editApplicationCommand(this.id, commandId, options);
}
editGuildCommand(guildId, commandId, options) {
return this._client.rest.editGuildApplicationCommand(this.id, guildId, commandId, options);
}
bulkOverwriteCommands(commands) {
return this._client.rest.bulkOverwriteApplicationCommands(this.id, commands);
}
bulkOverwriteGuildCommands(guildId, commands) {
return this._client.rest.bulkOverwriteGuildApplicationCommands(this.id, guildId, commands);
}
}
exports.ClientApplication = ClientApplication;