mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
Merge branch 'custom-structures'
This commit is contained in:
@@ -66,32 +66,37 @@ class Channel extends Base {
|
||||
}
|
||||
|
||||
static create(client, data, guild) {
|
||||
const DMChannel = require('./DMChannel');
|
||||
const GroupDMChannel = require('./GroupDMChannel');
|
||||
const TextChannel = require('./TextChannel');
|
||||
const VoiceChannel = require('./VoiceChannel');
|
||||
const CategoryChannel = require('./CategoryChannel');
|
||||
const GuildChannel = require('./GuildChannel');
|
||||
const Structures = require('../util/Structures');
|
||||
let channel;
|
||||
if (data.type === ChannelTypes.DM) {
|
||||
const DMChannel = Structures.get('DMChannel');
|
||||
channel = new DMChannel(client, data);
|
||||
} else if (data.type === ChannelTypes.GROUP) {
|
||||
const GroupDMChannel = Structures.get('GroupDMChannel');
|
||||
channel = new GroupDMChannel(client, data);
|
||||
} else {
|
||||
guild = guild || client.guilds.get(data.guild_id);
|
||||
if (guild) {
|
||||
switch (data.type) {
|
||||
case ChannelTypes.TEXT:
|
||||
case ChannelTypes.TEXT: {
|
||||
const TextChannel = Structures.get('TextChannel');
|
||||
channel = new TextChannel(guild, data);
|
||||
break;
|
||||
case ChannelTypes.VOICE:
|
||||
}
|
||||
case ChannelTypes.VOICE: {
|
||||
const VoiceChannel = Structures.get('VoiceChannel');
|
||||
channel = new VoiceChannel(guild, data);
|
||||
break;
|
||||
case ChannelTypes.CATEGORY:
|
||||
}
|
||||
case ChannelTypes.CATEGORY: {
|
||||
const CategoryChannel = Structures.get('CategoryChannel');
|
||||
channel = new CategoryChannel(guild, data);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
default: {
|
||||
const GuildChannel = Structures.get('GuildChannel');
|
||||
channel = new GuildChannel(guild, data);
|
||||
}
|
||||
}
|
||||
guild.channels.set(channel.id, channel);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const User = require('./User');
|
||||
const Structures = require('../util/Structures');
|
||||
const Collection = require('../util/Collection');
|
||||
const ClientUserSettings = require('./ClientUserSettings');
|
||||
const ClientUserGuildSettings = require('./ClientUserGuildSettings');
|
||||
@@ -11,7 +11,7 @@ const Guild = require('./Guild');
|
||||
* Represents the logged in client's Discord user.
|
||||
* @extends {User}
|
||||
*/
|
||||
class ClientUser extends User {
|
||||
class ClientUser extends Structures.get('User') {
|
||||
_patch(data) {
|
||||
super._patch(data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user