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) channel :Channel
The message channel id
- Source:
Type:
-
Channel
(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) 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
|
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
|
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 |
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 |
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 |
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
|
Example
message.reply("Hello");