From 699b2329224ebffb483de75aac88255a7ee1e36e Mon Sep 17 00:00:00 2001 From: cobalt <61329810+RedGuy12@users.noreply.github.com> Date: Tue, 10 Oct 2023 08:13:57 -0500 Subject: [PATCH] feat(BaseChannel): Add `isThreadOnly()` (#9847) * add isThreadBased * Update typings * fix name --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- packages/discord.js/src/structures/BaseChannel.js | 8 ++++++++ packages/discord.js/typings/index.d.ts | 1 + 2 files changed, 9 insertions(+) diff --git a/packages/discord.js/src/structures/BaseChannel.js b/packages/discord.js/src/structures/BaseChannel.js index 346f7630de24..473a5133e609 100644 --- a/packages/discord.js/src/structures/BaseChannel.js +++ b/packages/discord.js/src/structures/BaseChannel.js @@ -147,6 +147,14 @@ class BaseChannel extends Base { return 'bitrate' in this; } + /** + * Indicates whether this channel is {@link ThreadOnlyChannel thread-only}. + * @returns {boolean} + */ + isThreadOnly() { + return 'availableTags' in this; + } + toJSON(...props) { return super.toJSON({ createdTimestamp: true }, ...props); } diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 04a60dfb73f2..818d62afe0a8 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -942,6 +942,7 @@ export abstract class BaseChannel extends Base { public isTextBased(): this is TextBasedChannel; public isDMBased(): this is PartialGroupDMChannel | DMChannel | PartialDMChannel; public isVoiceBased(): this is VoiceBasedChannel; + public isThreadOnly(): this is ThreadOnlyChannel; public toString(): ChannelMention | UserMention; }