Skip to content

Commit

Permalink
Added endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
JustCat80 committed May 29, 2021
1 parent 6c27c37 commit 9a0f18c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 6 additions & 0 deletions lib/rest/Endpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ module.exports.BASE_URL = "/api/v" + REST_VERSION;
module.exports.CDN_URL = "https://cdn.discordapp.com";
module.exports.CLIENT_URL = "https://discord.com";

module.exports.APPLICATION_PERMISSIONS = (appID, guildID) => `/applications/${appID}/guilds/${guildID}/commands/permissions`;
module.exports.APPLICATION_COMMAND_PERMISSIONS = (appID, guildID, cmdID) => `/applications/${appID}/guilds/${guildID}/commands/${cmdID}/permissions`;
module.exports.ORIGINAL_INTERACTION_RESPONSE = (appID, interactToken) => `webhooks/${appID}/${interactToken}`;
module.exports.CHANNEL = (chanID) => `/channels/${chanID}`;
module.exports.CHANNEL_BULK_DELETE = (chanID) => `/channels/${chanID}/messages/bulk-delete`;
module.exports.CHANNEL_CALL_RING = (chanID) => `/channels/${chanID}/call/ring`;
Expand Down Expand Up @@ -65,6 +68,9 @@ module.exports.GUILD_WELCOME_SCREEN = (guildID)
module.exports.GUILD_WIDGET = (guildID) => `/guilds/${guildID}/widget`;
module.exports.GUILD_VOICE_STATE = (guildID, user) => `/guilds/${guildID}/voice-states/${user}`;
module.exports.GUILDS = "/guilds";
module.exports.INTERACTION_RESPONSE = (interactID, interactToken) => `interactions/${interactID}/${interactToken}/callback`;
module.exports.ORIGINAL_INTERACTION_RESPONSE = (appID, interactToken, msgID) => `webhooks/${appID}/${interactToken}/messages/${msgID}`;//@original or message id
module.exports.ORIGINAL_INTERACTION_RESPONSE = (appID, interactToken) => `webhooks/${appID}/${interactToken}`;
module.exports.INVITE = (inviteID) => `/invite/${inviteID}`;
module.exports.OAUTH2_APPLICATION = (appID) => `/oauth2/applications/${appID}`;
module.exports.USER = (userID) => `/users/${userID}`;
Expand Down
14 changes: 5 additions & 9 deletions lib/structures/Interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const Base = require("./Base");
const Message = require("./Message");
const Member = require("./Member");
const Constants = require("../Constants");
const Endpoints = require("../rest/Endpoints");

/**
* Represents a member's voice state in a call/guild
Expand Down Expand Up @@ -71,15 +72,10 @@ class Interaction extends Base {
* @returns {Promise<boolean>}
*/
async acknowledge() {
//clearTimeout(this._timeout);
await this._respond({
status: 200,
body: {
type: Constants.InteractionResponseType.DEFERRED_UPDATE_MESSAGE
}
}).catch(err => {return err})
return true;


this._client.requestHandler.request("POST", Endpoints.INTERACTION_RESPONSE(this.id, this.token), true, {
type: 6
});

//return false;
}
Expand Down

0 comments on commit 9a0f18c

Please sign in to comment.