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} * @type {?boolean}
*/ */
this.widgetEnabled = data.widget_enabled; this.widgetEnabled = data.widget_enabled;
} else {
this.widgetEnabled ??= null;
} }
if ('widget_channel_id' in data) { if ('widget_channel_id' in data) {
@@ -224,6 +226,8 @@ class Guild extends AnonymousGuild {
* @type {?string} * @type {?string}
*/ */
this.widgetChannelId = data.widget_channel_id; this.widgetChannelId = data.widget_channel_id;
} else {
this.widgetChannelId ??= null;
} }
if ('explicit_content_filter' in data) { if ('explicit_content_filter' in data) {
@@ -489,7 +493,7 @@ class Guild extends AnonymousGuild {
/** /**
* Widget channel for this guild * Widget channel for this guild
* @type {?TextChannel} * @type {?(TextChannel|NewsChannel|VoiceChannel|StageChannel)}
* @readonly * @readonly
*/ */
get widgetChannel() { get widgetChannel() {
@@ -656,14 +660,14 @@ class Guild extends AnonymousGuild {
* Data for the Guild Widget Settings object * Data for the Guild Widget Settings object
* @typedef {Object} GuildWidgetSettings * @typedef {Object} GuildWidgetSettings
* @property {boolean} enabled Whether the widget is enabled * @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 * The Guild Widget Settings object
* @typedef {Object} GuildWidgetSettingsData * @typedef {Object} GuildWidgetSettingsData
* @property {boolean} enabled Whether the widget is enabled * @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 vanityURLUses: number | null;
public get voiceAdapterCreator(): InternalDiscordGatewayAdapterCreator; public get voiceAdapterCreator(): InternalDiscordGatewayAdapterCreator;
public voiceStates: VoiceStateManager; public voiceStates: VoiceStateManager;
public get widgetChannel(): TextChannel | null; public get widgetChannel(): TextChannel | NewsChannel | VoiceBasedChannel | null;
public widgetChannelId: Snowflake | null; public widgetChannelId: Snowflake | null;
public widgetEnabled: boolean | null; public widgetEnabled: boolean | null;
public get maximumBitrate(): number; public get maximumBitrate(): number;
@@ -4830,7 +4830,7 @@ export interface GuildCreateOptions {
export interface GuildWidgetSettings { export interface GuildWidgetSettings {
enabled: boolean; enabled: boolean;
channel: NonThreadGuildBasedChannel | null; channel: TextChannel | NewsChannel | VoiceBasedChannel | null;
} }
export interface GuildEditData { export interface GuildEditData {
@@ -4908,7 +4908,7 @@ export interface GuildPruneMembersOptions {
export interface GuildWidgetSettingsData { export interface GuildWidgetSettingsData {
enabled: boolean; enabled: boolean;
channel: GuildChannelResolvable | null; channel: TextChannel | NewsChannel | VoiceBasedChannel | Snowflake | null;
} }
export interface GuildSearchMembersOptions { export interface GuildSearchMembersOptions {