TextChannel

TextChannel

new TextChannel()

Source:
Properties:
Name Type Attributes Description
rateLimitPerUser Number

Amount of seconds a user has to wait before sending another message (0-120); bots, as well as users with the permission manage_messages or manage_channel, are unaffected

topic String <nullable>

The topic of the text channel.

lastMessageID Snowflake <nullable>

The id of the last message sent

mention String

The mention for the channel

messages Store <nullable>

The messages of the channel stored in the cache.

parentID Snowflake <nullable>

The id of the category the channel is in

parent Object <nullable>

The category the channel is in

Extends

Methods

changePermissions(userOrRole, optionsopt) → {Promise.<(Member|Role)>}

Source:
Inherited From:

Edits the channel permission for the user or role

Parameters:
Name Type Attributes Description
userOrRole Snowflake

The id of the user or role

options Object <optional>

Options for the permission change

Properties
Name Type Attributes Description
allow String <optional>

The name of the permission to allow for the role or user

deny String <optional>

The name of the permission to deny for the role or user

type String <optional>

"member" for a user or "role" for a role

Returns:
Type
Promise.<(Member|Role)>

close() → {Promise.<(TextChannel|VoiceChannel|CategoryChannell)>}

Source:
Inherited From:

Closes a channel

Returns:
Type
Promise.<(TextChannel|VoiceChannel|CategoryChannell)>

createEmbed(embed) → {Promise.<Message>}

Source:

Creates an embed to the channel

Parameters:
Name Type Description
embed Object

The embed to send

Returns:
Type
Promise.<Message>

createInvite(optionsopt) → {Promise.<Invite>}

Source:
Inherited From:

Creates an invite for the guild channel

Parameters:
Name Type Attributes Description
options Object <optional>

Options for creating the invite

Properties
Name Type Attributes Default Description
maxAge Number <optional>
86400

Duration of invite in seconds, or 0 for never

maxUses Number <optional>
0

Maximum uses for the invite, or 0 for unlimited

temporary Boolean <optional>
false

Whether this invite should be temporary

unique= Boolean <optional>

If true, don't try to reuse a similar invite

Returns:
Type
Promise.<Invite>

createMessage(content) → {Promise.<Message>}

Source:

Similar to Client#createMessage() Creates a message to the channel

Parameters:
Name Type Description
content String

The content of the message

Returns:
Type
Promise.<Message>

(async) createReaction(message, emoji) → {Promise.<Message>}

Source:

Add a reaction to a message

Parameters:
Name Type Description
message Snowflake

The id of the message to add a reaction to

emoji String

The unicode of the emoji or for custom emojis, use name:id

  • For emojis that aren't custom, you need to get their unicode by doing: \:emojiname: for example, \:thinking: will give '🤔', then use it to react. While for customs, just do name:id
Returns:
Type
Promise.<Message>

delete() → {Promise.<(TextChannel|VoiceChannel|CategoryChannell)>}

Source:
Inherited From:

Similar to GuildChannel#delete. Closes a channel

Returns:
Type
Promise.<(TextChannel|VoiceChannel|CategoryChannell)>

edit(nameopt, positionopt) → {Promise.<(TextChannel|VoiceChannel|CategoryChannel)>}

Source:
Inherited From:

Edits the channel

Parameters:
Name Type Attributes Description
name String <optional>

The new name of the channel

position Number <optional>

The new position of the channel

Returns:
Type
Promise.<(TextChannel|VoiceChannel|CategoryChannel)>

getInvites() → {Promise.<Array.<Invite>>}

Source:
Inherited From:

Returns an array of Channel Invites

Returns:
Type
Promise.<Array.<Invite>>

getMessage(message) → {Promise.<Message>}

Source:

Fetch a single message If Client#storeMessages is true, it will try to fetch the message in the cache. And if it failed it would fetch the message through Discord's REST API And set it in the cache. Otherwise, if it's false, it would just fetch the message through Discord's REST API

Parameters:
Name Type Description
message Snowflake

The id of the message to fetch

Returns:
Type
Promise.<Message>

getMessages(options) → {Promise.<Array.<Message>>}

Source:

Fetches messages for the channel

Parameters:
Name Type Description
options Object

Query options for fetching Message

Properties
Name Type Attributes Default Description
limit Number <optional>
50

Maximum amount of messages to fetch

after Snowflake <optional>

Get messages after this message id

around Snowflake <optional>

Get messages around this message id

before Snowfalke <optional>

Get messages before this message id

Returns:
Type
Promise.<Array.<Message>>

getPinnedMessages() → {Promise.<Array.<Message>>}

Source:

Fetches all the pinned messages in the channel

Returns:
Type
Promise.<Array.<Message>>

getReactions(message, emoji, optionsopt) → {Promise.<Array.<User>>}

Source:

Get a list of users that reacted with the given emoji

Parameters:
Name Type Attributes Description
message Snowflake

The id of the message that has the reactions

emoji String

The emoji that the users reacted to

options Object <optional>

options for the fetch

Returns:
Type
Promise.<Array.<User>>

patchEmbed(message, content) → {Promise.<Message>}

Source:

Edits a message's embed, not content!

Parameters:
Name Type Description
message Snowflake

The id of the message to edit

content String

The new embed of the message, not content!

Returns:
Type
Promise.<Message>

patchMessage(message, content) → {Promise.<Message>}

Source:

Edits a message's content, not embed!

Parameters:
Name Type Description
message Snowflake

The id of the message to edit

content String

The new content of the message, not embed!

Returns:
Type
Promise.<Message>

removeAllReactions(message) → {Promise.<Message>}

Source:

Removes all reactions from the message

Parameters:
Name Type Description
message Snowflake

The id of the message you will remove all reactions from

Returns:
Type
Promise.<Message>

removeMessage(message, timeout) → {Void}

Source:

Deletes a single message

Parameters:
Name Type Default Description
message Snowflake

The id of the message deleted

timeout Number 0

The amount of time to wait before deleting the message in ms

Returns:

Would return "{ deleted: true }" if it got deleted

Type
Void

(async) removeMessages(limitopt)

Source:

Delete multiple messages in the channel

  • Minimum messages to delete: 1, Maximum: 100
Parameters:
Name Type Attributes Default Description
limit Number <optional>
50

The amount of messages to delete

(async) removeReaction(message, emoji) → {Promise.<Message>}

Source:

Deletes a reaction from a message

Parameters:
Name Type Description
message Snowflake

The id of the message to remove a reaction from

emoji String

The unicode of the emoji or for custom emojis, use name:id

  • For emojis that aren't custom, you need to get their unicode by doing: \:emojiname: for example, \:thinking: will give '🤔', then use it to react. While for customs, just do name:id
Returns:
Type
Promise.<Message>

(async) removeUserReaction(user, message, emoji) → {Promise.<Message>}

Source:

Deletes a user's reaction from a message

Parameters:
Name Type Description
user Snowflake

The id of the user that added the reaction

message Snowflake

The id of the message to remove a reaction from

emoji String

The unicode of the emoji or for custom emojis, use name:id

  • For emojis that aren't custom, you need to get their unicode by doing: \:emojiname: for example, \:thinking: will give '🤔', then use it to react. While for customs, just do name:id
Returns:
Type
Promise.<Message>