NewsChannel

NewsChannel

Represents a guild news channel. See TextChannel for more properties and methods

Constructor

new NewsChannel()

Source:

Extends

Methods

addMessageReaction(messageID, reaction) → {Promise}

Add a reaction to a message

Inherited From:
Source:
Parameters:
Name Type Description
messageID String

The ID of the message

reaction String

The reaction (Unicode string if Unicode emoji, emojiName:emojiID if custom emoji)

Returns:
Type:
Promise

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

Create an invite for the channel

Inherited From:
Source:
Parameters:
Name Type Attributes Description
options Object <optional>

Invite generation options

Name Type Attributes Description
maxAge Number <optional>

How long the invite should last in seconds

maxUses Number <optional>

How many uses the invite should last for

targetApplicationID String <optional>

The target application id

targetType Number <optional>

The type of the target application

targetUserID String <optional>

The ID of the user whose stream should be displayed for the invite (options.targetType must be 1)

temporary Boolean <optional>

Whether the invite grants temporary membership or not

unique Boolean <optional>

Whether the invite is unique or not

reason String <optional>

The reason to be displayed in audit logs

Returns:
Type:
Promise.<Invite>

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

Create a message in the channel

Inherited From:
Source:
Parameters:
Name Type Attributes Description
content String | Object

A string or object. If an object is passed:

Name Type Attributes Description
allowedMentions Object <optional>

A list of mentions to allow (overrides default)

Name Type Attributes Description
everyone Boolean <optional>

Whether or not to allow @everyone/@here

repliedUser Boolean <optional>

Whether or not to mention the author of the message being replied to

roles Boolean | Array.<String> <optional>

Whether or not to allow all role mentions, or an array of specific role mentions to allow

users Boolean | Array.<String> <optional>

Whether or not to allow all user mentions, or an array of specific user mentions to allow

attachments Array.<Object> <optional>

An array of attachment objects with the filename and description

Name Type Attributes Description
description String <optional>

The description of the file

filename String <optional>

The name of the file

id Number

The index of the file

components Array.<Object> <optional>

An array of component objects

content String <optional>

A content string

embed Object <optional>

[DEPRECATED] An embed object. See the official Discord API documentation entry for object structure

embeds Array.<Object> <optional>

An array of embed objects. See the official Discord API documentation entry for object structure

enforceNonce Boolean <optional>

If true and content.nonce is present, if multiple messages are sent with the same nonce within a few minutes of each other, that message will be returned and no new message created

flags Number <optional>

A number representing the flags to apply to the message (only SUPPRESS_EMBEDS and SUPPRESS_NOTIFICATIONS)

messageReference Object <optional>

The message reference, used when replying to or forwarding messages

Name Type Attributes Default Description
channelID String <optional>

The channel ID of the referenced message. Required when forwarding messages

failIfNotExists Boolean <optional>
true

Whether to throw an error if the message reference doesn't exist. If false, and the referenced message doesn't exist, the message is created without a referenced message

guildID String <optional>

The guild ID of the referenced message

messageID String

The message ID of the referenced message. This cannot reference a system message

type String <optional>
0

The type of reference. Either 0 (REPLY) or 1 (FORWARDED). Will become required in the future

messageReferenceID String <optional>

[DEPRECATED] The ID of the message should be replied to. Use messageReference instead

poll Object <optional>

A poll object. See the official Discord API documentation entry for object structure

nonce String | Number <optional>

A nonce value which will also appear in the messageCreate event

stickerIDs Array.<String> <optional>

An array of IDs corresponding to stickers to send

tts Boolean <optional>

Set the message TTS flag

file Object | Array.<Object> <optional>

A file object (or an Array of them)

Name Type Description
file Buffer

A buffer containing file data

name String

What to name the file

Returns:
Type:
Promise.<Message>

createThread(options) → {Promise.<(NewsThreadChannel|PublicThreadChannel|PrivateThreadChannel)>}

Create a thread without an existing message

Inherited From:
Source:
Parameters:
Name Type Description
options Object

The thread options

Name Type Attributes Description
autoArchiveDuration Number <optional>

The duration in minutes to automatically archive the thread after recent activity, either 60, 1440, 4320 or 10080 (thread channels only)

invitable Boolean <optional>

Whether non-moderators can add other non-moderators to the thread (private threads only)

name String

The thread channel name

rateLimitPerUser Number <optional>

The time in seconds a user has to wait before sending another message (0-21600) (does not affect bots or users with manageMessages/manageChannel permissions)

reason String <optional>

The reason to be displayed in audit logs

type Number <optional>

The channel type of the thread to create. Either 10 (announcement thread, announcement channels only), 11 (public thread) or 12 (private thread)

createThreadWithMessage(messageID, options) → {Promise.<(NewsThreadChannel|PublicThreadChannel)>}

Create a thread with an existing message

Inherited From:
Source:
Parameters:
Name Type Description
messageID String

The ID of the message to create the thread from

options Object

The thread options

Name Type Attributes Description
autoArchiveDuration Number <optional>

Duration in minutes to automatically archive the thread after recent activity, either 60, 1440, 4320 or 10080

name String

The thread channel name

rateLimitPerUser Number <optional>

The time in seconds a user has to wait before sending another message (0-21600) (does not affect bots or users with manageMessages/manageChannel permissions)

reason String <optional>

The reason to be displayed in audit logs

Returns:
Type:
Promise.<(NewsThreadChannel|PublicThreadChannel)>

createThreadWithoutMessage(options) → {Promise.<(NewsThreadChannel|PublicThreadChannel|PrivateThreadChannel)>}

[DEPRECATED] Create a thread without an existing message. Use createThread instead

Inherited From:
Source:
Parameters:
Name Type Description
options Object

The thread options

Name Type Attributes Description
autoArchiveDuration Number <optional>

Duration in minutes to automatically archive the thread after recent activity, either 60, 1440, 4320 or 10080

invitable Boolean <optional>

Whether non-moderators can add other non-moderators to the thread (private threads only)

name String

The thread channel name

rateLimitPerUser Number <optional>

The time in seconds a user has to wait before sending another message (0-21600) (does not affect bots or users with manageMessages/manageChannel permissions)

reason String <optional>

The reason to be displayed in audit logs

type Number <optional>

The channel type of the thread to create. Either 10 (announcement thread, announcement channels only), 11 (public thread) or 12 (private thread)

crosspostMessage(messageID) → {Promise.<Message>}

Crosspost (publish) a message to subscribed channels

Source:
Parameters:
Name Type Description
messageID String

The ID of the message

Returns:
Type:
Promise.<Message>

deleteMessage(messageID, reasonopt) → {Promise}

Delete a message

Inherited From:
Source:
Parameters:
Name Type Attributes Description
messageID String

The ID of the message

reason String <optional>

The reason to be displayed in audit logs

Returns:
Type:
Promise

deleteMessages(messageIDs, reasonopt) → {Promise}

Bulk delete messages (bot accounts only)

Inherited From:
Source:
Parameters:
Name Type Attributes Description
messageIDs Array.<String>

Array of message IDs to delete

reason String <optional>

The reason to be displayed in audit logs

Returns:
Type:
Promise

deletePermission(overwriteID, reasonopt) → {Promise}

Delete a channel permission overwrite

Inherited From:
Source:
Parameters:
Name Type Attributes Description
overwriteID String

The ID of the overwritten user or role

reason String <optional>

The reason to be displayed in audit logs

Returns:
Type:
Promise

editMessage(messageID, content) → {Promise.<Message>}

Edit a message

Inherited From:
Source:
Parameters:
Name Type Description
messageID String

The ID of the message

content String | Array | Object

A string, array of strings, or object. If an object is passed:

Name Type Attributes Description
allowedMentions Object <optional>

A list of mentions to allow (overrides default)

Name Type Attributes Description
everyone Boolean <optional>

Whether or not to allow @everyone/@here

roles Boolean | Array.<String> <optional>

Whether or not to allow all role mentions, or an array of specific role mentions to allow

users Boolean | Array.<String> <optional>

Whether or not to allow all user mentions, or an array of specific user mentions to allow

attachments Array.<Object> <optional>

An array of attachment objects that will be appended to the message, including new files. Only the provided files will be appended

Name Type Attributes Description
description String <optional>

The description of the file

filename String <optional>

The name of the file. This is not required if you are attaching a new file

id Number | String

The ID of the file. If you are attaching a new file, this would be the index of the file

components Array.<Object> <optional>

An array of component objects

content String <optional>

A content string

embed Object <optional>

[DEPRECATED] An embed object. See the official Discord API documentation entry for object structure

embeds Array.<Object> <optional>

An array of embed objects. See the official Discord API documentation entry for object structure

file Object | Array.<Object> <optional>

A file object (or an Array of them)

Name Type Description
file Buffer

A buffer containing file data

name String

What to name the file

flags Number <optional>

A number representing the flags to apply to the message. See the official Discord API documentation entry for flags reference

Returns:
Type:
Promise.<Message>

editPermission(overwriteID, allow, deny, type, reasonopt) → {Promise.<PermissionOverwrite>}

Create a channel permission overwrite

Inherited From:
Source:
Parameters:
Name Type Attributes Description
overwriteID String

The ID of the overwritten user or role

allow BigInt | Number | String

The permissions number for allowed permissions

deny BigInt | Number | String

The permissions number for denied permissions

type Number

The object type of the overwrite, either 1 for "member" or 0 for "role"

reason String <optional>

The reason to be displayed in audit logs

Returns:
Type:
Promise.<PermissionOverwrite>

endPoll(messageID) → {Promise.<Message>}

Immediately end a poll. Note: You cannot end polls from other users.

Inherited From:
Source:
Parameters:
Name Type Description
messageID String

The ID of the message that the poll is in

Returns:
Type:
Promise.<Message>

follow(webhookChannelID, reasonopt) → {Object}

Follow this channel in another channel. This creates a webhook in the target channel

Source:
Parameters:
Name Type Attributes Description
webhookChannelID String

The ID of the target channel

reason String <optional>

The reason to be displayed in audit logs

Returns:
Type:
Object

An object containing this channel's ID and the new webhook's ID

getArchivedThreads(type, optionsopt) → {Promise.<Object>}

Get all archived threads in this channel

Inherited From:
Source:
Parameters:
Name Type Attributes Description
type String

The type of thread channel, either "public" or "private"

options Object <optional>

Additional options when requesting archived threads

Name Type Attributes Description
before Date <optional>

List of threads to return before the timestamp

limit Number <optional>

Maximum number of threads to return

Returns:
Type:
Promise.<Object>

An object containing an array of threads, an array of members and whether the response hasMore threads that could be returned in a subsequent call

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

Get all invites in the channel

Inherited From:
Source:
Returns:
Type:
Promise.<Array.<Invite>>

getJoinedPrivateArchivedThreads(optionsopt) → {Promise.<Object>}

Get joined private archived threads in this channel

Inherited From:
Source:
Parameters:
Name Type Attributes Description
options Object <optional>

Additional options when requesting archived threads

Name Type Attributes Description
before Date <optional>

List of threads to return before the timestamp

limit Number <optional>

Maximum number of threads to return

Returns:
Type:
Promise.<Object>

An object containing an array of threads, an array of members and whether the response hasMore threads that could be returned in a subsequent call

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

Get a previous message in the channel

Inherited From:
Source:
Parameters:
Name Type Description
messageID String

The ID of the message

Returns:
Type:
Promise.<Message>

getMessageReaction(messageID, reaction, optionsopt, beforeopt, afteropt) → {Promise.<Array.<User>>}

Get a list of users who reacted with a specific reaction

Inherited From:
Source:
Parameters:
Name Type Attributes Description
messageID String

The ID of the message

reaction String

The reaction (Unicode string if Unicode emoji, emojiName:emojiID if custom emoji)

options Object <optional>

Options for the request. If this is a number, it is treated as options.limit ([DEPRECATED] behavior)

Name Type Attributes Default Description
after String <optional>

Get users after this user ID

limit Number <optional>
100

The maximum number of users to get

type Number <optional>
0

The type of reaction (0 for normal, 1 for burst)

before String <optional>

[DEPRECATED] Get users before this user ID. Discord no longer supports this parameter

after String <optional>

[DEPRECATED] Get users after this user ID

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

getMessages(optionsopt, beforeopt, afteropt, aroundopt) → {Promise.<Array.<Message>>}

Get previous messages in the channel

Inherited From:
Source:
Parameters:
Name Type Attributes Description
options Object <optional>

Options for the request. If this is a number ([DEPRECATED] behavior), it is treated as options.limit

Name Type Attributes Default Description
after String <optional>

Get messages after this message ID

around String <optional>

Get messages around this message ID (does not work with limit > 100)

before String <optional>

Get messages before this message ID

limit Number <optional>
50

The max number of messages to get

before String <optional>

[DEPRECATED] Get messages before this message ID

after String <optional>

[DEPRECATED] Get messages after this message ID

around String <optional>

[DEPRECATED] Get messages around this message ID (does not work with limit > 100)

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

getPins(optionsopt) → {Promise.<{hasMore: Boolean, items: Array.<{pinnedAt: Number, message: Message}>}>}

Get pinned messages in the channel

Inherited From:
Source:
Parameters:
Name Type Attributes Description
options Object <optional>

The options to use to get pinned messages

Name Type Attributes Default Description
before Date <optional>

Get pinned messages before this date

limit Number <optional>
50

The max number of pinned messages to get (1-50, default 50)

Returns:
Type:
Promise.<{hasMore: Boolean, items: Array.<{pinnedAt: Number, message: Message}>}>

getPollAnswerVoters(messageID, answerID, optionsopt) → {Promise.<Array.<User>>}

Get a list of users that voted for a specific poll answer

Inherited From:
Source:
Parameters:
Name Type Attributes Description
messageID String

The ID of the message that the poll is in

answerID Number

The ID of the answer to get voters for

options Object <optional>

Options for the request

Name Type Attributes Default Description
after String <optional>

Get users after this user ID

limit Number <optional>
25

The max number of users to get

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

An array of users who voted for this answer

pinMessage(messageID) → {Promise}

Pin a message

Inherited From:
Source:
Parameters:
Name Type Description
messageID String

The ID of the message

Returns:
Type:
Promise

purge(options, filteropt, beforeopt, afteropt, reasonopt) → {Promise.<Number>}

Purge previous messages in the channel with an optional filter

Inherited From:
Source:
Parameters:
Name Type Attributes Description
options Object

Options for the request. If this is a number ([DEPRECATED] behavior), it is treated as options.limit

Name Type Attributes Description
after String <optional>

Get messages after this message ID

before String <optional>

Get messages before this message ID

filter function <optional>

Optional filter function that returns a boolean when passed a Message object

limit Number

The max number of messages to search through, -1 for no limit

reason String <optional>

The reason to be displayed in audit logs

filter function <optional>

[DEPRECATED] Optional filter function that returns a boolean when passed a Message object

before String <optional>

[DEPRECATED] Get messages before this message ID

after String <optional>

[DEPRECATED] Get messages after this message ID

reason String <optional>

[DEPRECATED] The reason to be displayed in audit logs

Returns:
Type:
Promise.<Number>

Resolves with the number of messages deleted

removeMessageReaction(messageID, reaction, userIDopt) → {Promise}

Remove a reaction from a message

Inherited From:
Source:
Parameters:
Name Type Attributes Default Description
messageID String

The ID of the message

reaction String

The reaction (Unicode string if Unicode emoji, emojiName:emojiID if custom emoji)

userID String <optional>
"@me"

The ID of the user to remove the reaction for

Returns:
Type:
Promise

removeMessageReactionEmoji(messageID, reaction) → {Promise}

Remove all reactions from a message for a single emoji

Inherited From:
Source:
Parameters:
Name Type Description
messageID String

The ID of the message

reaction String

The reaction (Unicode string if Unicode emoji, emojiName:emojiID if custom emoji)

Returns:
Type:
Promise

removeMessageReactions(messageID) → {Promise}

Remove all reactions from a message

Inherited From:
Source:
Parameters:
Name Type Description
messageID String

The ID of the message

Returns:
Type:
Promise

sendTyping() → {Promise}

Send typing status in the channel

Inherited From:
Source:
Returns:
Type:
Promise

unpinMessage(messageID) → {Promise}

Unpin a message

Inherited From:
Source:
Parameters:
Name Type Description
messageID String

The ID of the message

Returns:
Type:
Promise

unsendMessage(messageID) → {Promise}

Un-send a message. You're welcome Programmix

Inherited From:
Source:
Parameters:
Name Type Description
messageID String

The ID of the message

Returns:
Type:
Promise