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

@@ -133,14 +133,14 @@ class Channel extends Base {
}
static create(client, data, guild, { allowUnknownGuild, fromInteraction } = {}) {
if (!CategoryChannel) CategoryChannel = require('./CategoryChannel');
if (!DMChannel) DMChannel = require('./DMChannel');
if (!NewsChannel) NewsChannel = require('./NewsChannel');
if (!StageChannel) StageChannel = require('./StageChannel');
if (!StoreChannel) StoreChannel = require('./StoreChannel');
if (!TextChannel) TextChannel = require('./TextChannel');
if (!ThreadChannel) ThreadChannel = require('./ThreadChannel');
if (!VoiceChannel) VoiceChannel = require('./VoiceChannel');
CategoryChannel ??= require('./CategoryChannel');
DMChannel ??= require('./DMChannel');
NewsChannel ??= require('./NewsChannel');
StageChannel ??= require('./StageChannel');
StoreChannel ??= require('./StoreChannel');
TextChannel ??= require('./TextChannel');
ThreadChannel ??= require('./ThreadChannel');
VoiceChannel ??= require('./VoiceChannel');
let channel;
if (!data.guild_id && !guild) {
@@ -151,7 +151,7 @@ class Channel extends Base {
channel = new PartialGroupDMChannel(client, data);
}
} else {
if (!guild) guild = client.guilds.cache.get(data.guild_id);
guild ??= client.guilds.cache.get(data.guild_id);
if (guild || allowUnknownGuild) {
switch (data.type) {