mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 16:43:31 +01:00
feat(PartialGroupDMChannel): to support Invite#channel for group dms (#3786)
* add PartialGroupDMChannel class * fix lint * add new errors * add new class to Channel.create * fix lint * update typings accordingly * better implement errors * remove unnecessary functions * oops * lint * lint * lint * more lint * more lint * jsdoc typo * suggested changes * i did not forget the typings
This commit is contained in:
@@ -96,9 +96,19 @@ class Channel extends Base {
|
||||
static create(client, data, guild) {
|
||||
const Structures = require('../util/Structures');
|
||||
let channel;
|
||||
if (data.type === ChannelTypes.DM || (data.type !== ChannelTypes.GROUP && !data.guild_id && !guild)) {
|
||||
const DMChannel = Structures.get('DMChannel');
|
||||
channel = new DMChannel(client, data);
|
||||
if (!data.guild_id && !guild) {
|
||||
switch (data.type) {
|
||||
case ChannelTypes.DM: {
|
||||
const DMChannel = Structures.get('DMChannel');
|
||||
channel = new DMChannel(client, data);
|
||||
break;
|
||||
}
|
||||
case ChannelTypes.GROUP: {
|
||||
const PartialGroupDMChannel = require('./PartialGroupDMChannel');
|
||||
channel = new PartialGroupDMChannel(client, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
guild = guild || client.guilds.cache.get(data.guild_id);
|
||||
if (guild) {
|
||||
|
||||
Reference in New Issue
Block a user