fix(Guild): Widget channel types and fixes (#8530)

fix: various widget fixes

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Jiralite
2022-08-21 10:28:31 +01:00
committed by GitHub
parent b3f7c32f7f
commit 23a0b6ccf2
2 changed files with 10 additions and 6 deletions

View File

@@ -216,6 +216,8 @@ class Guild extends AnonymousGuild {
* @type {?boolean}
*/
this.widgetEnabled = data.widget_enabled;
} else {
this.widgetEnabled ??= null;
}
if ('widget_channel_id' in data) {
@@ -224,6 +226,8 @@ class Guild extends AnonymousGuild {
* @type {?string}
*/
this.widgetChannelId = data.widget_channel_id;
} else {
this.widgetChannelId ??= null;
}
if ('explicit_content_filter' in data) {
@@ -489,7 +493,7 @@ class Guild extends AnonymousGuild {
/**
* Widget channel for this guild
* @type {?TextChannel}
* @type {?(TextChannel|NewsChannel|VoiceChannel|StageChannel)}
* @readonly
*/
get widgetChannel() {
@@ -656,14 +660,14 @@ class Guild extends AnonymousGuild {
* Data for the Guild Widget Settings object
* @typedef {Object} GuildWidgetSettings
* @property {boolean} enabled Whether the widget is enabled
* @property {?GuildChannel} channel The widget invite channel
* @property {?(TextChannel|NewsChannel|VoiceChannel|StageChannel)} channel The widget invite channel
*/
/**
* The Guild Widget Settings object
* @typedef {Object} GuildWidgetSettingsData
* @property {boolean} enabled Whether the widget is enabled
* @property {?GuildChannelResolvable} channel The widget invite channel
* @property {?(TextChannel|NewsChannel|VoiceChannel|StageChannel|Snowflake)} channel The widget invite channel
*/
/**

View File

@@ -1127,7 +1127,7 @@ export class Guild extends AnonymousGuild {
public vanityURLUses: number | null;
public get voiceAdapterCreator(): InternalDiscordGatewayAdapterCreator;
public voiceStates: VoiceStateManager;
public get widgetChannel(): TextChannel | null;
public get widgetChannel(): TextChannel | NewsChannel | VoiceBasedChannel | null;
public widgetChannelId: Snowflake | null;
public widgetEnabled: boolean | null;
public get maximumBitrate(): number;
@@ -4830,7 +4830,7 @@ export interface GuildCreateOptions {
export interface GuildWidgetSettings {
enabled: boolean;
channel: NonThreadGuildBasedChannel | null;
channel: TextChannel | NewsChannel | VoiceBasedChannel | null;
}
export interface GuildEditData {
@@ -4908,7 +4908,7 @@ export interface GuildPruneMembersOptions {
export interface GuildWidgetSettingsData {
enabled: boolean;
channel: GuildChannelResolvable | null;
channel: TextChannel | NewsChannel | VoiceBasedChannel | Snowflake | null;
}
export interface GuildSearchMembersOptions {