mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
fix(GuildAuditLog): Remove Promises in constructor (#7089)
This commit is contained in:
@@ -7,6 +7,8 @@ const { Error } = require('../errors');
|
||||
const { Endpoints } = require('../util/Constants');
|
||||
const Permissions = require('../util/Permissions');
|
||||
|
||||
// TODO: Convert `inviter` and `channel` in this class to a getter.
|
||||
|
||||
/**
|
||||
* Represents an invitation to a guild channel.
|
||||
* @extends {Base}
|
||||
@@ -106,12 +108,24 @@ class Invite extends Base {
|
||||
this.maxUses ??= null;
|
||||
}
|
||||
|
||||
if ('inviter_id' in data) {
|
||||
/**
|
||||
* The user's id who created this invite
|
||||
* @type {?Snowflake}
|
||||
*/
|
||||
this.inviterId = data.inviter_id;
|
||||
this.inviter = this.client.users.resolve(data.inviter_id);
|
||||
} else {
|
||||
this.inviterId ??= null;
|
||||
}
|
||||
|
||||
if ('inviter' in data) {
|
||||
/**
|
||||
* The user who created this invite
|
||||
* @type {?User}
|
||||
*/
|
||||
this.inviter = this.client.users._add(data.inviter);
|
||||
this.inviter ??= this.client.users._add(data.inviter);
|
||||
this.inviterId = data.inviter.id;
|
||||
} else {
|
||||
this.inviter ??= null;
|
||||
}
|
||||
@@ -154,12 +168,22 @@ class Invite extends Base {
|
||||
this.targetType ??= null;
|
||||
}
|
||||
|
||||
if ('channel_id' in data) {
|
||||
/**
|
||||
* The channel's id this invite is for
|
||||
* @type {Snowflake}
|
||||
*/
|
||||
this.channelId = data.channel_id;
|
||||
this.channel = this.client.channels.cache.get(data.channel_id);
|
||||
}
|
||||
|
||||
if ('channel' in data) {
|
||||
/**
|
||||
* The channel this invite is for
|
||||
* @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.channelId ??= data.channel.id;
|
||||
}
|
||||
|
||||
if ('created_at' in data) {
|
||||
|
||||
Reference in New Issue
Block a user