This commit is contained in:
Gus Caplan 2020-12-11 15:10:12 -06:00
parent 8c65961a07
commit 2b8a6294af
No known key found for this signature in database
GPG key ID: F00BD11880E82F0E
2 changed files with 27 additions and 2 deletions

View file

@ -1,8 +1,8 @@
'use strict'; 'use strict';
const BaseClient = require('./BaseClient'); const BaseClient = require('./BaseClient');
const ApplicationCommand = require('../structures/ApplicationCommand');
const Interaction = require('../structures/Interaction'); const Interaction = require('../structures/Interaction');
const ApplicationCommand = require('../structures/InteractionCommand');
const { ApplicationCommandOptionType, InteractionType, InteractionResponseType } = require('../util/Constants'); const { ApplicationCommandOptionType, InteractionType, InteractionResponseType } = require('../util/Constants');
let sodium; let sodium;
@ -50,7 +50,7 @@ class InteractionClient extends BaseClient {
/** /**
* Get registered slash commands. * Get registered slash commands.
* @param {Snowflake?} guildID Optional guild ID. * @param {Snowflake?} guildID Optional guild ID.
* @returns {[Command]} * @returns {Command[]}
*/ */
async getCommands(guildID) { async getCommands(guildID) {
let path = this.client.api.applications('@me'); let path = this.client.api.applications('@me');

View file

@ -23,14 +23,39 @@ class ApplicationCommand extends Base {
} }
_patch(data) { _patch(data) {
/**
* The ID of this command.
* @type {Snowflake}
* @readonly
*/
this.id = data.id; this.id = data.id;
/**
* The ID of the application which owns this command.
* @type {Snowflake}
* @readonly
*/
this.appplicationID = data.application_id; this.appplicationID = data.application_id;
/**
* The name of this command.
* @type {string}
* @readonly
*/
this.name = data.name; this.name = data.name;
/**
* The description of this command.
* @type {string}
* @readonly
*/
this.description = data.description; this.description = data.description;
/**
* The options of this command.
* @type {Object[]}
* @readonly
*/
this.options = data.options.map(function m(o) { this.options = data.options.map(function m(o) {
return { return {
type: ApplicationCommandOptionType[o.type], type: ApplicationCommandOptionType[o.type],