Skip to content

Commit

Permalink
interaction.channelID is now interaction.channel, similar to message
Browse files Browse the repository at this point in the history
  • Loading branch information
JustCat80 committed Aug 20, 2021
1 parent f4474bd commit 66c85cf
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
12 changes: 6 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2397,8 +2397,8 @@ declare namespace Eris {
pong(): Promise<void>;
}

export class CommandInteraction extends Interaction {
channelID: string;
export class CommandInteraction<T extends PossiblyUncachedTextable = TextableChannel> extends Interaction {
channel: T;
data: {
id: string;
name: string;
Expand Down Expand Up @@ -2428,8 +2428,8 @@ declare namespace Eris {
getOriginalMessage(): Promise<Message>
}

export class ComponentInteraction extends Interaction {
channelID: string;
export class ComponentInteraction<T extends PossiblyUncachedTextable = TextableChannel> extends Interaction {
channel: T;
data: {
component_type: 2 | 3;
custom_id: string;
Expand All @@ -2452,8 +2452,8 @@ declare namespace Eris {
getOriginalMessage(): Promise<Message>
}

export class UnknownInteraction extends Interaction {
channelID?: string;
export class UnknownInteraction<T extends PossiblyUncachedTextable = TextableChannel> extends Interaction {
channel?: T;
data?: unknown;
guildID?: string;
member?: Member;
Expand Down
10 changes: 5 additions & 5 deletions lib/structures/CommandInteraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const {InteractionResponseTypes} = require("../Constants");
/**
* Represents an application command interaction. See Interaction for more properties.
* @extends Interaction
* @prop {String} channelID The ID of the channel in which the interaction was created
* @prop {PrivateChannel | TextChannel | NewsChannel} channel The channel the interaction was created in. Can be partial with only the id if the channel is not cached.
* @prop {Object} data The data attached to the interaction
* @prop {String} data.id The ID of the Application Command
* @prop {String} data.name The command name
Expand All @@ -37,9 +37,9 @@ class CommandInteraction extends Interaction {
constructor(info, client) {
super(info, client);

if(info.channel_id !== undefined) {
this.channelID = info.channel_id;
}
this.channel = this._client.getChannel(info.channel_id) || {
id: info.channel_id
};

this.data = info.data;

Expand Down Expand Up @@ -92,7 +92,7 @@ class CommandInteraction extends Interaction {
}

if(info.member !== undefined) {
this.member = new Member(info.member, client.guilds.get(info.guild_id), this._client);
this.member = new Member(info.member, this._client.guilds.get(info.guild_id), this._client);
}

if(info.user !== undefined) {
Expand Down
10 changes: 5 additions & 5 deletions lib/structures/ComponentInteraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {InteractionResponseTypes} = require("../Constants");
/**
* Represents a message component interaction. See Interaction for more properties.
* @extends Interaction
* @prop {String} channelID The ID of the channel in which the interaction was created
* @prop {PrivateChannel | TextChannel | NewsChannel} channel The channel the interaction was created in. Can be partial with only the id if the channel is not cached.
* @prop {Object} data The data attached to the interaction
* @prop {Number} data.component_type The type of Message Component
* @prop {String} data.custom_id The ID of the Message Component
Expand All @@ -23,9 +23,9 @@ class ComponentInteraction extends Interaction {
constructor(info, client) {
super(info, client);

if(info.channel_id !== undefined) {
this.channelID = info.channel_id;
}
this.channel = this._client.getChannel(info.channel_id) || {
id: info.channel_id
};

this.data = info.data;

Expand All @@ -34,7 +34,7 @@ class ComponentInteraction extends Interaction {
}

if(info.member !== undefined) {
this.member = new Member(info.member, client.guilds.get(info.guild_id), this._client);
this.member = new Member(info.member, this._client.guilds.get(info.guild_id), this._client);
}

if(info.message !== undefined) {
Expand Down
2 changes: 1 addition & 1 deletion lib/structures/Interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Interaction extends Base {
}
}

client.emit("warn", new Error(`Unknown interaction type: ${data.type}\n${JSON.stringify(data)}`));
this._client.emit("warn", new Error(`Unknown interaction type: ${data.type}\n${JSON.stringify(data)}`));
return new UnknownInteraction(data, client);
}
}
Expand Down
8 changes: 5 additions & 3 deletions lib/structures/UnknownInteraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {InteractionResponseTypes, MessageFlags} = require("../Constants");
/**
* Represents an unknown interaction. See Interaction for more properties.
* @extends Interaction
* @prop {String?} channelID The ID of the channel in which the interaction was created
* @prop {PrivateChannel? | TextChannel? | NewsChannel?} channel The channel the interaction was created in. Can be partial with only the id if the channel is not cached.
* @prop {Object?} data The data attached to the interaction
* @prop {String?} guildID The ID of the guild in which the interaction was created
* @prop {Member?} member The member who triggered the interaction (This is only sent when the interaction is invoked within a guild)
Expand All @@ -21,7 +21,9 @@ class UnknownInteraction extends Interaction {
super(info, client);

if(info.channel_id !== undefined) {
this.channelID = info.channel_id;
this.channel = this._client.getChannel(info.channel_id) || {
id: info.channel_id
};
}

if(info.data !== undefined) {
Expand All @@ -33,7 +35,7 @@ class UnknownInteraction extends Interaction {
}

if(info.member !== undefined) {
this.member = new Member(info.member, client.guilds.get(info.guild_id), this._client);
this.member = new Member(info.member, this._client.guilds.get(info.guild_id), this._client);
}

if(info.message !== undefined) {
Expand Down

0 comments on commit 66c85cf

Please sign in to comment.