mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
fix(invite): add back channelId property (#7501)
This commit is contained in:
@@ -151,12 +151,24 @@ class Invite extends Base {
|
|||||||
this.targetType ??= null;
|
this.targetType ??= null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ('channel_id' in data) {
|
||||||
|
/**
|
||||||
|
* The id of the channel this invite is for
|
||||||
|
* @type {?Snowflake}
|
||||||
|
*/
|
||||||
|
this.channelId = data.channel_id;
|
||||||
|
}
|
||||||
|
|
||||||
if ('channel' in data) {
|
if ('channel' in data) {
|
||||||
/**
|
/**
|
||||||
* The channel this invite is for
|
* The channel this invite is for
|
||||||
* @type {?Channel}
|
* @type {?Channel}
|
||||||
*/
|
*/
|
||||||
this.channel = this.client.channels._add(data.channel, this.guild, { cache: false });
|
this.channel =
|
||||||
|
this.client.channels._add(data.channel, this.guild, { cache: false }) ??
|
||||||
|
this.client.channels.resolve(this.channelId);
|
||||||
|
|
||||||
|
this.channelId ??= data.channel.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('created_at' in data) {
|
if ('created_at' in data) {
|
||||||
@@ -285,6 +297,7 @@ class Invite extends Base {
|
|||||||
presenceCount: false,
|
presenceCount: false,
|
||||||
memberCount: false,
|
memberCount: false,
|
||||||
uses: false,
|
uses: false,
|
||||||
|
channel: 'channelId',
|
||||||
inviter: 'inviterId',
|
inviter: 'inviterId',
|
||||||
guild: 'guildId',
|
guild: 'guildId',
|
||||||
});
|
});
|
||||||
|
|||||||
3
packages/discord.js/typings/index.d.ts
vendored
3
packages/discord.js/typings/index.d.ts
vendored
@@ -1381,7 +1381,8 @@ export class InteractionWebhook extends PartialWebhookMixin() {
|
|||||||
|
|
||||||
export class Invite extends Base {
|
export class Invite extends Base {
|
||||||
private constructor(client: Client, data: RawInviteData);
|
private constructor(client: Client, data: RawInviteData);
|
||||||
public channel: NonThreadGuildBasedChannel | PartialGroupDMChannel;
|
public channel: NonThreadGuildBasedChannel | PartialGroupDMChannel | null;
|
||||||
|
public channelId: Snowflake | null;
|
||||||
public code: string;
|
public code: string;
|
||||||
public get deletable(): boolean;
|
public get deletable(): boolean;
|
||||||
public get createdAt(): Date | null;
|
public get createdAt(): Date | null;
|
||||||
|
|||||||
Reference in New Issue
Block a user