Skip to content

Commit

Permalink
fix: suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
monbrey committed Nov 13, 2024
1 parent 569ce9e commit a598257
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 25 deletions.
20 changes: 4 additions & 16 deletions packages/discord.js/src/structures/InteractionCallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,27 @@ class InteractionCallback {
*/
this.type = data.type;

/**
* The id of the channel the original interaction was sent in
* @type {?Snowflake}
*/
this.channelId = data.channel_id ?? null;

/**
* The id of the guild the original interaction was sent in
* @type {Snowflake}
*/
this.guildId = data.guild_id ?? null;

/**
* The instance id of the Activity if one was launched or joined
* @type {string}
* @type {?string}
*/
this.activityInstanceId = data.activity_instance_id ?? null;

/**
* The id of the message that was created by the interaction
* @type {Snowflake}
* @type {?Snowflake}
*/
this.responseMessageId = data.response_message_id ?? null;

/**
* Whether the message is in a loading state
* @type {boolean}
* @type {?boolean}
*/
this.responseMessageLoading = data.response_message_loading ?? null;

/**
* Whether the response message was ephemeral
* @type {boolean}
* @type {?boolean}
*/
this.responseMessageEphemeral = data.response_message_ephemeral ?? null;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
'use strict';

const { lazy } = require('@discordjs/util');

const getMessage = lazy(() => require('./Message').Message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const InteractionCallback = require('./InteractionCallback');
const InteractionCallbackResource = require('./InteractionCallbackResource');

/**
* Represents an interaction's response
*/
Expand All @@ -22,7 +23,7 @@ class InteractionCallbackResponse {
this.interaction = new InteractionCallback(client, data.interaction);

/**
* The resource that was created by the interaction response
* The resource that was created by the interaction response
* @type {?InteractionCallbackResource}
*/
this.resource = data.resource ? new InteractionCallbackResource(client, data.resource) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ class InteractionResponses {

if (options.withResponse) {
return new InteractionCallbackResponse(this.client, response);
} else {
return options.fetchReply ? this.fetchReply() : new InteractionResponse(this);
}

return options.fetchReply ? this.fetchReply() : new InteractionResponse(this);
}

/**
Expand Down Expand Up @@ -143,9 +143,9 @@ class InteractionResponses {

if (options.withResponse) {
return new InteractionCallbackResponse(this.client, response);
} else {
return options.fetchReply ? this.fetchReply() : new InteractionResponse(this);
}

return options.fetchReply ? this.fetchReply() : new InteractionResponse(this);
}

/**
Expand Down Expand Up @@ -235,9 +235,9 @@ class InteractionResponses {

if (options.withResponse) {
return new InteractionCallbackResponse(this.client, response);
} else {
return options.fetchReply ? this.fetchReply() : new InteractionResponse(this, this.message?.interaction?.id);
}

return options.fetchReply ? this.fetchReply() : new InteractionResponse(this, this.message?.interaction?.id);
}

/**
Expand Down Expand Up @@ -275,9 +275,9 @@ class InteractionResponses {

if (options.withResponse) {
return new InteractionCallbackResponse(this.client, response);
} else {
return options.fetchReply ? this.fetchReply() : new InteractionResponse(this, this.message.interaction?.id);
}

return options.fetchReply ? this.fetchReply() : new InteractionResponse(this, this.message.interaction?.id);
}

/**
Expand Down

0 comments on commit a598257

Please sign in to comment.