GuildTextChannel
- class GuildTextChannel()
A standard text or announcement channel in a guild.
Example
const channel = await discord.fetchGuildTextChannel('1504537312841961583'); if (channel) await channel.send('Deployment finished.');
exported from
lib.weeble.d- Extends:
Properties
- GuildTextChannel.nsfw
type: readonly boolean | undefined
Indicates whether this channel is marked as not-safe-for-work.
- GuildTextChannel.rateLimitPerUser
type: readonly number | undefined
Slow mode cooldown in seconds (0 = disabled).
- GuildTextChannel.topic
type: readonly string | null | undefined
The channel topic, or
nullif not set.
- GuildTextChannel.type
type: readonly 0 | 5
Text and announcement channels share the text-channel API.
Methods
- async GuildTextChannel.bulkDelete(messageIds: string[], reason: string) Promise<void>
Bulk delete messages by ID (Discord limit: 2-100, older than 2 weeks fails).
- Parameters:
messageIds — – Array of message IDs to delete.
reason — – The reason for the audit log.
-
async GuildTextChannel.createPoll(question: string, answers: string[], duration: number, allowMultiselect: boolean) Promise<
Message> Create a poll in this channel.
- Parameters:
question — – The poll question.
answers — – Array of poll answers.
duration — – Duration of the poll in hours.
allowMultiselect — – Whether members can select multiple answers.
- Returns:
The message containing the poll.
-
async GuildTextChannel.createThread(options:
ThreadCreateOptions) Promise<ThreadChannel> Create a new thread in this channel.
- Parameters:
options — – Thread creation options including name and auto-archive duration.
- Returns:
The created thread.
-
async GuildTextChannel.createThreadFromMessage(messageId: string, options:
ThreadFromMessageCreateOptions) Promise<ThreadChannel> Create a thread from an existing message.
- Parameters:
messageId — – The ID of the source message.
options — – Thread creation options including name and auto-archive duration.
- Returns:
The created thread.
-
async GuildTextChannel.createWebhook(options: { avatar?: string; name: string; reason?: string; }) Promise<
Webhook> Create a webhook for this channel.
- Parameters:
options — – Webhook creation options including name and optional avatar.
- Returns:
The created webhook.
-
async GuildTextChannel.edit(options:
GuildTextChannelEditOptions) Promise<GuildTextChannel> Edit channel properties.
- Parameters:
options — – The channel properties to update.
- Returns:
The updated channel.
-
async GuildTextChannel.fetchMessages(options:
FetchMessagesOptions) Promise<Message[]> Fetch recent messages with optional pagination.
- Parameters:
options — – Optional pagination parameters.
- Returns:
Array of messages.
-
async GuildTextChannel.fetchPinnedMessages() Promise<
Message[]> Fetch all pinned messages in this channel.
- Returns:
Array of pinned messages.
-
async GuildTextChannel.fetchPins(options: { before?: string | Date; limit?: number; }) Promise<
PinPage> Fetch a page of pinned messages with Discord’s cursor-based pins API.
-
async GuildTextChannel.fetchWebhooks() Promise<
Webhook[]> Fetch all webhooks in this channel.
- Returns:
Array of webhooks.
-
async GuildTextChannel.getMessage(messageId: string) Promise<
Message| null> Fetch a specific message by ID, or
nullif not found.- Parameters:
messageId — – The ID of the message to fetch.
- Returns:
The message, or null if not found.
-
async GuildTextChannel.send(content: string |
SendMessageOptions) Promise<Message> Send a message in this channel.
- Parameters:
content — – The message content or send options.
- Returns:
The sent message.
-
async GuildTextChannel.setNsfw(nsfw: boolean) Promise<
GuildTextChannel> Convenience method to toggle the NSFW flag.
- Parameters:
nsfw — – Whether the channel should be NSFW.
- Returns:
The updated channel.
-
async GuildTextChannel.setSlowmode(seconds: number) Promise<
GuildTextChannel> Convenience method to set the slow mode cooldown.
- Parameters:
seconds — – Slow mode cooldown in seconds (0 to disable).
- Returns:
The updated channel.
-
async GuildTextChannel.setTopic(topic: string | null) Promise<
GuildTextChannel> Convenience method to set the channel topic.
- Parameters:
topic — – The new topic, or null to clear.
- Returns:
The updated channel.