new Conversation()
The Conversation class represent a conversation between one or multiple person on Curse. It can be a small group conversation, a server channel conversation, a server private conversation, a friend conversation, or a adhoc conversation. If it's a server channel conversation then the channel property is set to the corresponding channel.
Properties:
Name | Type | Description |
---|---|---|
ID |
string | Curse UUID of the current Conversation. This ID is shared with the corresponding Channel if it's a server channel conversation. |
client |
Client | Client object used to create this Conversation instance. |
conversationType |
number | Specify the type of the current Conversation following the conversations-v1 ConversationType endpoint definition. Friendship = 0, Group = 1, AdHoc = 2, GroupPrivateConversation = 3. |
channel |
Channel | Corresponding Channel object of the current Conversation if and only if the Conversation is a conversation of an existing channel and not a private conversation. |
- Source:
Methods
deleteMessage(message, callback)
Delete a specified message
Parameters:
Name | Type | Description |
---|---|---|
message |
Message | Message object |
callback |
function | Facultative arg, callback: (errors) => {}. This function can take an argument errors that is null or undefined when function ends correctly. |
- Source:
editMessage(newContent, message, callback)
Edit the content of a specified message
Parameters:
Name | Type | Description |
---|---|---|
newContent |
string | Text of the new message |
message |
Message | Message object |
callback |
function | Facultative arg, callback: (errors) => {}. This function can take an argument errors that is null or undefined when function ends correctly. |
- Source:
everyHistoryMessages(callback)
Iterate through all the past messages of this conversation. From now to the first message.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | callback: (errors, message, done) => {}.
|
- Source:
Example
myChannel.everyHistoryMessages(function(errors, message, done){
if(errors == null && !done){
//We can handle message history like message notifications
console.log(message.serverTimestamp, message.senderName, message.content);
if(message.content == "stop"){
//This will stop the scrolling when a message with the content stop is found
return false;
}
}
});
sendMessage(messageContent, callback)
send a message to the current conversation.
Parameters:
Name | Type | Description |
---|---|---|
messageContent |
string | Text content of the message. |
callback |
function | Facultative arg, callback: (errors) => {}. This function can take an argument errors that is null or undefined when function ends correctly. |
- Source: