Channel has. You get one from guild.channels, message.channel, the channel of a command, or a channel option.
How to send, edit and read messages is in Sending messages. This page lists what the channels have; each kind has its own page below.
Which kind of channel
A channel you get fromguild.channels or message.channel can be of any kind. Ask it before using what only one kind has: inside the if, your editor knows the kind.
type says the same thing as a value of ChannelType:
A kind Discord added after this version is still usable: as a
GuildChannel when it is in a server, as a Channel otherwise.
TextChannel
A text or announcement channel of a server.
VoiceChannel
A voice or stage channel: people talk in it, and can write too.
CategoryChannel
A category: it groups channels.
ForumChannel
A forum or media channel: it only contains posts, which are threads.
ThreadChannel
A thread, or a post of a forum.
DMChannel
A private conversation between the bot and a user.
Channel
A channel of any kind. Use theis...() methods to know which kind it is and get the properties and actions of that kind. Every class of this section has what is listed here.
Properties
Helpers
These read what the bot already knows: they never send a request.isTextBased()
isGuildChannel()
isText()
isVoice()
isCategory()
isForum()
isThread()
isDM()
toString()
<#id>: links the channel when put in a message.
toJSON()
Reading from Discord
fetch()
Actions
delete()
GuildChannel
A channel of a server (not a thread).TextChannel, VoiceChannel, CategoryChannel and ForumChannel have everything listed here, plus what Channel has.
Properties
What roles and members are allowed or denied in this channel. Each entry is a
PermissionOverwrite.Helpers
permissionsFor()
Reading from Discord
fetchInvites()
fetchWebhooks()
Actions
edit()
GuildChannelEditOptions.
Discord documentation
setPermissions()
deletePermissions()
createInvite()
InviteCreateOptions.
Discord documentation
createWebhook()
The image of the default avatar of the webhook, as a data URI (
data:image/png;base64,...).Channels with messages
TextChannel, VoiceChannel, ThreadChannel and DMChannel can all send and read messages: they share the properties and methods of this section. Together they are the TextBasedChannel type.
Properties
messages is empty unless one of your files asks for messages to be remembered: see what the bot remembers. fetchMessage() and fetchMessages() always work.Reading from Discord
fetchMessage()
fetchMessages()
FetchMessagesOptions.
Discord documentation
fetchPins()
Actions
send()
MessageInput.
Discord documentation
bulkDelete()
sendTyping()
Waiting
They wait for what comes next in the channel, while your bot runs: a restart ends the wait. How to use them is in the guide.waitForMessage()
from), saying something (matches). Anyone’s but a bot’s by default. Resolves with the message, or null when within (one minute by default) passed first. A restart of the bot ends the wait.
collectMessages()
within (one minute by default) passed or max came. Resolves with them, in order.
Types
TextBasedChannel
message.channel and interaction.channel give; isTextBased() narrows a Channel to it.
GuildTextBasedChannel
channel of a GuildMessage and of a command used in a server.
WaitForMessageOptions
WhatwaitForMessage() takes.
Only a message that says this: a text (the same, whatever the capitals and the spaces around), a regular expression, or a function of the message.
CollectMessagesOptions
WhatcollectMessages() takes: everything WaitForMessageOptions has, and:
PersonInput
Elsewhere
PermissionOverwrite: an entry ofpermissionOverwrites.GuildChannelEditOptions,InviteCreateOptionsandFetchMessagesOptions: whatedit(),createInvite()andfetchMessages()take.MessageInput: whatsend()takes.