mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 09:03:29 +01:00
refactor(*): use async functions (#6210)
This commit is contained in:
@@ -198,9 +198,10 @@ class GuildAuditLogs {
|
||||
* Handles possible promises for entry targets.
|
||||
* @returns {Promise<GuildAuditLogs>}
|
||||
*/
|
||||
static build(...args) {
|
||||
static async build(...args) {
|
||||
const logs = new GuildAuditLogs(...args);
|
||||
return Promise.all(logs.entries.map(e => e.target)).then(() => logs);
|
||||
await Promise.all(logs.entries.map(e => e.target));
|
||||
return logs;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -500,19 +501,17 @@ class GuildAuditLogsEntry {
|
||||
),
|
||||
);
|
||||
} else if (targetType === Targets.INVITE) {
|
||||
this.target = guild.members.fetch(guild.client.user.id).then(me => {
|
||||
this.target = guild.members.fetch(guild.client.user.id).then(async me => {
|
||||
if (me.permissions.has(Permissions.FLAGS.MANAGE_GUILD)) {
|
||||
let change = this.changes.find(c => c.key === 'code');
|
||||
change = change.new ?? change.old;
|
||||
return guild.invites.fetch().then(invites => {
|
||||
this.target = invites.find(i => i.code === change) ?? null;
|
||||
});
|
||||
const invites = await guild.invites.fetch();
|
||||
this.target = invites.find(i => i.code === change) ?? null;
|
||||
} else {
|
||||
this.target = this.changes.reduce((o, c) => {
|
||||
o[c.key] = c.new ?? c.old;
|
||||
return o;
|
||||
}, {});
|
||||
return this.target;
|
||||
}
|
||||
});
|
||||
} else if (targetType === Targets.MESSAGE) {
|
||||
|
||||
Reference in New Issue
Block a user