💬Message

The 'Message' component is a 'GuildMessage' component as for now. This can change in the future by moving some data into an extension of 'Message'.

Properties

PropertyDescriptionType

_data

Original message data.

Object

_client

the client that receives the channel data

id

id of the message

String

type

type of message ('user' or 'system')

String

channel

channel where the message has been sent

member

message author

guildID

id of the message's server

String

channelID

id of the message's channel

String

content

message content

String

embeds

message's embed(s)

Array<Object>

isPrivate

is message private? true/false

Boolean

isSilent

if the message doesn't notify a user

Boolean

mentions

Message mentions object

Object (MentionsType)

_createdAt

timestamp that the message was created at

Number

memberID

id of the message author

String

_updatedAt

timestamp that the message was updated at

Number|null

_deletedAt

Timestamp (unix epoch time) of the message's deletion.

Number|null

webhookID

The ID of the webhook who created this message, if it was created by a webhook

String

replyMessageIds

List of ids mentioned in the message

Array

_lastMessageID

last message sent with the message itself (cache)

String

_originalMessageID

Original message, used to reply this one (cache)

String

_originalMessageBool

Used by the system to detect if the original message id has been transfered

Boolean

oldContent

old message content if edited

String

createdAt

string representation of the _createdAt timestamp.

Date

updatedAt

string representation of the _updatedAt timestamp.

Date|void

deletedAt

string representation of the _deletedAt timestamp.

Date|void

member

Get the member component, which returns Member when message guildID and memberID is defined or if Member is cached.

Member|undefined

guild

Guild component where the message has been sent

Guild

channel

Channel component where the message has been sent on

Constructor

new Message(rawData, client, params)
PropertiesDescriptionTypeRequired?

rawData

raw data received from ws and converted to JSON

Object

true

client

Client

true

params?

Object of params

Object

false

params.oldMessage?

old message component, if cached.

false

params.originalMessageID?

ID of the transfered original message. If existant.

String

false

Do not use this constructor unless you know what you're doing. This constructor is used to return you rawdata into component.

Methods

createMessage(options)

Create a message in the message's channel.

PropertiesDescriptionTypeRequired?

options

message's options

Object

true

options.content

message content

String

false

options.embeds

message's embeds

Array<Object>

false

options.replyMessageIds

list of message id to reply

Array<String>

false

options.isSilent

notify user(s)?

Boolean

false

options.isPrivate

message will only be seen by those mentioned or replied to

Boolean

false

Returns: Promise<Message>

edit(newMessage)

Update/edit the message.

PropertiesDescriptionTypeRequired?

newMessage

edit options

Object

true

newMessage.content

message content

String

false

newMessage.embeds

message's embeds

Object

false

Returns: Promise<Message>

delete()

Delete the message.

Returns: Promise<void>

editLastMessage(newMessage)

Edit the last message sent with the message itself.

PropertiesDescriptionTypeRequired?

newMessage

edit options

Object

true

newMessage.content

message content

String

false

newMessage.embeds

message's embeds

Object

false

Returns: Promise<Message>

deleteLastMessage()

Delete the last message sent with he message itself.

Returns: Promise<boolean>

editOriginalMessage(newMessage)

Edit the message's original message, if existant.

PropertiesDescriptionTypeRequired?

newMessage

edit options

Object

true

newMessage.content

message content

String

false

newMessage.embeds

message's embeds

Object

false

Returns: Promise<Message>

deleteOriginalMessage()

Delete the message's original message, if existant.

Returns: Promise<boolean>

addReaction(reaction)

Add a reaction to the message.

PropertiesDescriptionTypeRequired?

reaction

reaction id

Number

true

Returns: Promise<void>

removeReaction(reaction)

Remove a specific reaction from the message.

PropertiesDescriptionTypeRequired?

reaction

reaction id

Number

true

Returns: Promise<void>

Last updated