Preview environment

interface PublicThreadChannel

extends

ThreadChannel<Forum>
export interface PublicThreadChannel<Forum extends boolean = boolean> extends ThreadChannel<Forum>

Type Parameters

optional
Forum? extends boolean = boolean

appliedTags : Snowflake[]

The tags applied to this thread

Inherited from: ThreadChannel

archived : boolean | null

Whether the thread is archived

Inherited from: ThreadChannel

readonly
archivedAt : Date | null

The time at which this thread's archive status was last changed If the thread was never archived or unarchived, this is the time at which the thread was created

Inherited from: ThreadChannel

archiveTimestamp : number | null

The timestamp when the thread's archive status was last changed If the thread was never archived or unarchived, this is the timestamp at which the thread was created

Inherited from: ThreadChannel

autoArchiveDuration : ThreadAutoArchiveDuration | null

The amount of time (in minutes) after which the thread will automatically archive in case of no recent activity

Inherited from: ThreadChannel

readonly
client : Client<true>

The client that instantiated this

Inherited from: Base

readonly
createdAt : Date | null

The time the thread was created at

Inherited from: ThreadChannel

readonly
createdTimestamp : number | null

The timestamp when this thread was created. This isn't available for threads created before 2022-01-09

Inherited from: ThreadChannel

readonly
editable : boolean

Whether the thread is editable by the client user (name, archived, autoArchiveDuration)

Inherited from: ThreadChannel

The flags that are applied to the channel. This is only null in a PartialGroupDMChannel. In all other cases, it is not null.

Inherited from: ThreadChannel

guild : Guild

The guild the thread is in

Inherited from: ThreadChannel

guildId : Snowflake

The id of the guild the channel is in

Inherited from: ThreadChannel

readonly
guildMembers : Collection<Snowflake, GuildMember>

A collection of associated guild member objects of this thread's members

Inherited from: ThreadChannel

The channel's id

Inherited from: BaseChannel

invitable : boolean | null

Whether members without the PermissionFlagsBits.ManageThreads permission can invite other members to this thread. This property is always null in public threads.

Inherited from: ThreadChannel

readonly
joinable : boolean

Whether the thread is joinable by the client user

Inherited from: ThreadChannel

readonly
joined : boolean

Whether the client user is a member of the thread.

Inherited from: ThreadChannel

readonlyoptional
lastMessage? : Message

The Message object of the last message in the channel, if one was sent

Inherited from: ThreadChannel

optional
lastMessageId? : Snowflake

The last message id sent in this thread, if one was sent

Inherited from: ThreadChannel

readonlyoptional
lastPinAt? : Date

The date when the last pinned message was pinned, if there was one

Inherited from: ThreadChannel

optional
lastPinTimestamp? : number

The timestamp when the last pinned message was pinned, if there was one

Inherited from: ThreadChannel

locked : boolean | null

Whether the thread is locked

Inherited from: ThreadChannel

readonly
manageable : boolean

Whether the thread is manageable by the client user, for deleting or editing rateLimitPerUser or locked.

Inherited from: ThreadChannel

memberCount : number | null

The approximate count of users in this thread This stops counting at 50. If you need an approximate value higher than that, use ThreadChannel#members.cache.size

Inherited from: ThreadChannel

A manager of the members that are part of this thread

Inherited from: ThreadChannel

messageCount : number | null

The approximate count of messages in this thread Threads created before July 1, 2022 may have an inaccurate count. If you need an approximate value higher than that, use ThreadChannel#messages.cache.size

Inherited from: ThreadChannel

A manager of the messages sent to this thread

Inherited from: ThreadChannel

name : string

The name of the thread

Inherited from: ThreadChannel

ownerId : Snowflake | null

The id of the member who created this thread

Inherited from: ThreadChannel

readonly
parent : If<ThreadOnly, ForumChannel | MediaChannel, TextChannel | NewsChannel> | null

The parent channel of this thread

Inherited from: ThreadChannel

parentId : Snowflake | null

The id of the parent channel of this thread

Inherited from: ThreadChannel

readonly
partial : false

Whether this Channel is a partial This is always false outside of DM channels.

Inherited from: BaseChannel

rateLimitPerUser : number | null

The rate limit per user (slowmode) for this thread in seconds

Inherited from: ThreadChannel

readonly
sendable : boolean

Whether the client user can send messages in this thread

Inherited from: ThreadChannel

totalMessageSent : number | null

The number of messages ever sent in a thread, similar to messageCount except it will not decrement whenever a message is deleted

Inherited from: ThreadChannel

readonly
unarchivable : boolean

Whether the thread is unarchivable by the client user

Inherited from: ThreadChannel

readonly
url : string

The URL to the channel

Inherited from: BaseChannel

readonly
viewable : boolean

Whether the thread is viewable by the client user

Inherited from: ThreadChannel

Collects a single component interaction that passes the filter. The Promise will reject if the time expires.

Examples:
// Collect a message component interaction
const filter = (interaction) => interaction.customId === 'button' && interaction.user.id === 'someId';
channel.awaitMessageComponent({ filter, time: 15_000 })
  .then(interaction => console.log(`${interaction.customId} was clicked!`))
  .catch(console.error);

Inherited from: ThreadChannel

Similar to createMessageCollector but in promise form. Resolves with a collection of messages that pass the specified filter.

Examples:
// Await !vote messages
const filter = m => m.content.startsWith('!vote');
// Errors: ['time'] treats ending because of the time limit as an error
channel.awaitMessages({ filter, max: 4, time: 60_000, errors: ['time'] })
  .then(collected => console.log(collected.size))
  .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`));

Inherited from: ThreadChannel

Bulk deletes given messages that are newer than two weeks.

Examples:
// Bulk delete messages
channel.bulkDelete(5)
  .then(messages => console.log(`Bulk deleted ${messages.size} messages`))
  .catch(console.error);

Returns: Returns the deleted messages *

Inherited from: ThreadChannel

createMessageCollector() : MessageCollector

Creates a Message Collector.

Examples:
// Create a message collector
const filter = message => message.content.includes('discord');
const collector = channel.createMessageCollector({ filter, time: 15_000 });
collector.on('collect', message => console.log(`Collected ${message.content}`));
collector.on('end', collected => console.log(`Collected ${collected.size} items`));

Inherited from: ThreadChannel

createMessageComponentCollector() : InteractionCollector

Creates a component interaction collector.

Examples:
// Create a button interaction collector
const filter = (interaction) => interaction.customId === 'button' && interaction.user.id === 'someId';
const collector = channel.createMessageComponentCollector({ filter, time: 15_000 });
collector.on('collect', interaction => console.log(`Collected ${interaction.customId}`));
collector.on('end', collected => console.log(`Collected ${collected.size} items`));

Inherited from: ThreadChannel

delete(
reason?: string
) : Promise<this>

Deletes this thread.

Examples:
// Delete the thread
thread.delete('cleaning out old threads')
  .then(deletedThread => console.log(deletedThread))
  .catch(console.error);

Inherited from: ThreadChannel

edit() : Promise<this>

Edits this thread.

Examples:
// Edit a thread
thread.edit({ name: 'new-thread' })
  .then(editedThread => console.log(editedThread))
  .catch(console.error);

Inherited from: ThreadChannel

fetch(
force?: boolean
) : Promise<this>

Fetches this channel.

Inherited from: BaseChannel

fetchOwner() : Promise<ThreadMember | null>

Fetches the owner of this thread. If the thread member object isn't needed, use ownerId instead.

Inherited from: ThreadChannel

fetchStarterMessage() : Promise<Message<true> | null>

Fetches the message that started this thread, if any. The Promise will reject if the original message in a forum post is deleted or when the original message in the parent channel is deleted. If you just need the id of that message, use id instead.

Inherited from: ThreadChannel

Indicates whether this channel is DM-based (either a DMChannel or a PartialGroupDMChannel).

Inherited from: BaseChannel

isSendable() : this is SendableChannels

Indicates whether this channel is sendable.

Inherited from: BaseChannel

isTextBased() : this is TextBasedChannel

Indicates whether this channel is text-based.

Inherited from: BaseChannel

isThread() : this is AnyThreadChannel

Indicates whether this channel is a ThreadChannel.

Inherited from: BaseChannel

isThreadOnly() : this is ThreadOnlyChannel

Indicates whether this channel is thread-only.

Inherited from: BaseChannel

isVoiceBased() : this is VoiceBasedChannel

Indicates whether this channel is voice-based.

Inherited from: BaseChannel

join() : Promise<this>

Makes the client user join the thread.

Inherited from: ThreadChannel

leave() : Promise<this>

Makes the client user leave the thread.

Inherited from: ThreadChannel

permissionsFor(
memberOrRole: GuildMember | Role
checkAdmin?: boolean
) : Readonly<PermissionsBitField>

Gets the overall set of permissions for a member or role in this thread's parent channel, taking overwrites into account.

pin(
reason?: string
) : Promise<If<ThreadOnly, this, never>>

Pins this thread from the forum channel (only applicable to forum threads).

Inherited from: ThreadChannel

Sends a message to this channel.

Examples:
// Send a basic message
channel.send('hello!')
  .then(message => console.log(`Sent message: ${message.content}`))
  .catch(console.error);
// Send a remote file
channel.send({
  files: ['https://cdn.discordapp.com/icons/222078108977594368/6e1019b3179d71046e463a75915e7244.png?size=2048']
})
  .then(console.log)
  .catch(console.error);
// Send a local file
channel.send({
  files: [{
    attachment: 'entire/path/to/file.jpg',
    name: 'file.jpg',
    description: 'A description of the file'
  }]
})
  .then(console.log)
  .catch(console.error);

Inherited from: ThreadChannel

sendTyping() : Promise<void>

Sends a typing indicator in the channel.

Examples:
// Start typing in a channel
channel.sendTyping();

Returns: Resolves upon the typing status being sent *

Inherited from: ThreadChannel

setAppliedTags(
appliedTags: readonly Snowflake[]
reason?: string
) : Promise<If<ThreadOnly, this, never>>

Set the applied tags for this channel (only applicable to forum threads)

Inherited from: ThreadChannel

setArchived(
archived?: boolean
reason?: string
) : Promise<this>

Sets whether the thread is archived.

Examples:
// Archive the thread
thread.setArchived(true)
  .then(newThread => console.log(`Thread is now ${newThread.archived ? 'archived' : 'active'}`))
  .catch(console.error);

Inherited from: ThreadChannel

setAutoArchiveDuration(
autoArchiveDuration: ThreadAutoArchiveDuration
reason?: string
) : Promise<this>

Sets the duration after which the thread will automatically archive in case of no recent activity.

Examples:
// Set the thread's auto archive time to 1 hour
thread.setAutoArchiveDuration(ThreadAutoArchiveDuration.OneHour)
  .then(newThread => {
    console.log(`Thread will now archive after ${newThread.autoArchiveDuration} minutes of inactivity`);
   });
  .catch(console.error);

Inherited from: ThreadChannel

setInvitable(
invitable?: boolean
reason?: string
) : Promise<this>

Sets whether members without the PermissionFlagsBits.ManageThreads permission can invite other members to this thread.

Inherited from: ThreadChannel

setLocked(
locked?: boolean
reason?: string
) : Promise<this>

Sets whether the thread can be **unarchived* * by anyone with the PermissionFlagsBits.SendMessages permission. When a thread is locked, only members with the PermissionFlagsBits.ManageThreads permission can unarchive it.

Examples:
// Set the thread to locked
thread.setLocked(true)
  .then(newThread => console.log(`Thread is now ${newThread.locked ? 'locked' : 'unlocked'}`))
  .catch(console.error);

Inherited from: ThreadChannel

setName(
name: string
reason?: string
) : Promise<this>

Sets a new name for this thread.

Examples:
// Change the thread's name
thread.setName('not_general')
  .then(newThread => console.log(`Thread's new name is ${newThread.name}`))
  .catch(console.error);

Inherited from: ThreadChannel

setRateLimitPerUser(
rateLimitPerUser: number
reason?: string
) : Promise<ThreadChannel>

Sets the rate limit per user (slowmode) for this thread.

Inherited from: ThreadChannel

toJSON(
...props: Record<string, boolean | string>[]
) : unknown

Inherited from: Base

toString() : ChannelMention

When concatenated with a string, this automatically returns the channel's mention instead of the Channel object.

Examples:
// Logs: Hello from <#123456789012345678>!
console.log(`Hello from ${channel}!`);

Inherited from: ThreadChannel

unpin(
reason?: string
) : Promise<If<ThreadOnly, this, never>>

Unpins this thread from the forum channel (only applicable to forum threads).

Inherited from: ThreadChannel

valueOf() : string

Inherited from: Base