Appearance
Channel
Package: @erinjs/core
Base class for all channel types.
Constructor
| Name | Type | Optional | Description |
|---|---|---|---|
client | Client | No | |
data | APIChannelPartial | No | API channel from GET /channels/{id} or GET /guilds/{id}/channels |
Properties
| Name | Type | Readonly | Optional | Description |
|---|---|---|---|---|
client | Client | Yes | No | |
icon | string | null | No | No | Channel icon hash (Group DMs). Null if none. |
id | string | Yes | No | |
lastPinTimestamp | string | null | No | No | ISO timestamp when the last message was pinned. Null if never pinned. |
name | string | null | No | No | Channel name. Guild channels and Group DMs have names; 1:1 DMs are typically null. |
type | ChannelType | No | No |
Methods
bulkDeleteMessages() async
Bulk delete messages. Requires Manage Messages permission.
Returns: Promise<void>
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
messageIds | string[] | No | Array of message IDs to delete (2–100) |
canSendMessage()
Whether the bot can send messages in this channel. For DMs: always true (when the channel exists). For guild channels: checks ViewChannel and SendMessages permissions via guild.members.me.
Returns: boolean
Parameters:
None
createDM()
Create a DM channel from API data (type DM or GroupDM).
Returns: DMChannel
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
client | Client | No | |
data | APIChannelPartial | No |
from()
Create the appropriate channel subclass from API data.
Returns: GuildChannel | TextChannel | null
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
client | Client | No | The client instance |
data | any | No | Channel data from the API |
fromOrCreate()
Create a channel from API data, including DM and GroupDM. Used by ChannelManager.fetch() for GET /channels/{id}.
Returns: DMChannel | GuildChannel | TextChannel | null
Parameters:
| Name | Type | Optional | Description |
|---|---|---|---|
client | Client | No | |
data | any | No |
isDM()
Whether this channel is a DM or Group DM.
Returns: boolean
Parameters:
None
isLink()
Returns: boolean
Parameters:
None
isTextBased()
Whether this channel has a send method (TextChannel, DMChannel).
Returns: boolean
Parameters:
None
isVoice()
Whether this channel is voice-based (VoiceChannel).
Returns: boolean
Parameters:
None
sendTyping() async
Send a typing indicator to the channel. Lasts ~10 seconds.
Returns: Promise<void>
Parameters:
None