Message

Message

Represents a message

Constructor

new Message(messageData, client) → {Message}

Creates a new message object

Source:
Parameters:
Name Type Description
messageData Object

The message data

client Object

The client object

Returns:
Type:
Message
Example
const { Message } = require('guilded.js');
const message = new Message(messageData, client);

Members

(readonly) attachments :Array

The attachments of the message

Source:
Type:
  • Array

(readonly) author :User

The author of the message

Source:
Type:

(readonly) channel :Channel

The message channel id

Source:
Type:
  • Channel

(readonly) client :Client

Client object

Source:
Type:

(readonly) content :String

The content of the message

Source:
Type:
  • String

(readonly) createdAt :Date

The created date of the message

Source:
Type:
  • Date

(readonly) editedAt :Date|null

The updated date (if the message was edited)

Source:
Type:
  • Date | null

(readonly) hasReplies :Boolean

Check if the message has replies

Source:
Type:
  • Boolean

(readonly) id :String

The message id

Source:
Type:
  • String

(readonly) private :Boolean

Check if the message is private

Source:
Type:
  • Boolean

(readonly) raw :Object

All data of the message (for debugging)

Source:
Type:
  • Object

(readonly) replyMessageIds :Array.<String>

The message replies

Source:
Type:
  • Array.<String>

(readonly) serverId :Server|null

The server Object

Source:
Type:
  • Server | null

(readonly) webhookId :String|null

The webhook id of the message

Source:
Type:
  • String | null

Methods

delete(options) → {Message}

Delete the current message

Source:
Parameters:
Name Type Description
options Object

The options for the delete

Name Type Description
timeout Number

The timeout for the delete

Returns:
Type:
Message

The message object

Example
message.delete();
message.delete({ timeout: 5000 });

edit(content) → {Message}

Edit the current message

Source:
Parameters:
Name Type Description
content String | Object

The content of the message, this can be a string or an object

Name Type Description
content String

The content of the message

isPrivate Boolean

Whether the message is private or not

isSilent Boolean

Whether the message is silent or not

replyMessageIds Array

The message ids to reply to

embeds Array

The embeds to send

attachments Array

The attachments to send

Returns:
Type:
Message

The message object

Example
message.edit("Hello world!");

getMember(userId) → {Member}

Get the member object of the author of the message or the member you want to get

Source:
Parameters:
Name Type Description
userId string

optional - The user id of the member you want to get info from

Returns:
Type:
Member
  • The member object
Example
message.getMember();
message.getMember("123456789");

getUser(userId) → {User}

Get the user object of the author of the message or the user you want to get

Source:
Parameters:
Name Type Description
userId string

optional - The user id of the user you want to get info from

Returns:
Type:
User
  • The user object
Example
message.getUser();
message.getUser("123456789");

react(emoji) → {Reaction}

Add a reaction to the current message

Source:
Parameters:
Name Type Description
emoji Number

The emoji to react with

Returns:
Type:
Reaction

The reaction object

Example
message.react(90001164);

reply(content) → {Message}

Send a message to the current channel to the user who sent the message

Source:
Parameters:
Name Type Description
content String | Object

The content of the message, this can be a string or an object

Name Type Description
content String

The content of the message

isPrivate Boolean

Whether the message is private or not

isSilent Boolean

Whether the message is silent or not

replyMessageIds Array

The message ids to reply to

embeds Array

The embeds to send

attachments Array

The attachments to send

Returns:
Type:
Message

The message object

Example
message.reply("Hello");