Skip to content

Commit

Permalink
fix(Guild): Widget channel types and fixes (#8530)
Browse files Browse the repository at this point in the history
fix: various widget fixes

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
Jiralite and kodiakhq[bot] committed Aug 21, 2022
1 parent b3f7c32 commit 23a0b6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions packages/discord.js/src/structures/Guild.js
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -489,7 +493,7 @@ class Guild extends AnonymousGuild {

/**
* Widget channel for this guild
* @type {?TextChannel}
* @type {?(TextChannel|NewsChannel|VoiceChannel|StageChannel)}
* @readonly
*/
get widgetChannel() {
Expand Down Expand Up @@ -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
*/

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/discord.js/typings/index.d.ts
Expand Up @@ -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;
Expand Down Expand Up @@ -4830,7 +4830,7 @@ export interface GuildCreateOptions {

export interface GuildWidgetSettings {
enabled: boolean;
channel: NonThreadGuildBasedChannel | null;
channel: TextChannel | NewsChannel | VoiceBasedChannel | null;
}

export interface GuildEditData {
Expand Down Expand Up @@ -4908,7 +4908,7 @@ export interface GuildPruneMembersOptions {

export interface GuildWidgetSettingsData {
enabled: boolean;
channel: GuildChannelResolvable | null;
channel: TextChannel | NewsChannel | VoiceBasedChannel | Snowflake | null;
}

export interface GuildSearchMembersOptions {
Expand Down

0 comments on commit 23a0b6c

Please sign in to comment.