refactor: ES2021 features (#6540)

Co-authored-by: Antonio Román <kyradiscord@gmail.com>
Co-authored-by: Voltrex <mohammadkeyvanzade94@gmail.com>
This commit is contained in:
Rodry
2021-09-03 12:58:01 +01:00
committed by GitHub
parent d81590d566
commit 00bd92a451
35 changed files with 145 additions and 156 deletions

View File

@@ -380,9 +380,7 @@ class ApplicationCommandPermissionsManager extends BaseManager {
if (!commandId && this.guild) {
commandId = this.guild.commands.resolveId(command);
}
if (!commandId) {
commandId = this.client.application?.commands.resolveId(command);
}
commandId ??= this.client.application?.commands.resolveId(command);
if (!commandId) {
throw new TypeError('INVALID_TYPE', 'command', 'ApplicationCommandResolvable', true);
}

View File

@@ -238,7 +238,7 @@ class GuildManager extends CachedManager {
this.client.removeListener(Events.GUILD_CREATE, handleGuild);
this.client.decrementMaxListeners();
resolve(this.client.guilds._add(data));
}, 10000).unref();
}, 10_000).unref();
});
}

View File

@@ -420,7 +420,7 @@ class GuildMemberManager extends CachedManager {
for (const member of members.values()) {
fetchedMembers.set(member.id, member);
}
if (members.size < 1000 || (limit && fetchedMembers.size >= limit) || i === chunk.count) {
if (members.size < 1_000 || (limit && fetchedMembers.size >= limit) || i === chunk.count) {
clearTimeout(timeout);
this.client.removeListener(Events.GUILD_MEMBERS_CHUNK, handler);
this.client.decrementMaxListeners();