Chat Message
The same callback is called even when a user has entered multiple channels at the same time.
You must make a logic that prints messages separately based on the channel information the messages carry.
Description
The following details callback methods, call methods, and information classes related to chat messages.
Callback methods
// This callback method is relayed when a chat message is received. It transfers the message information.
public void OnChatMessage(MessageInfo messageInfo) { }
// This callback method is relayed when a whisper message is received. It transfers the message information.
public void OnWhisperMessage(WhisperMessageInfo messageInfo) { }
// This callback method is relayed when the console hides a message. It transfers the message's information.
public void OnHideMessage(MessageInfo messageInfo) { }
// This callback method is relayed when the console deletes a message. It transfers the message's information.
public void OnDeleteMessage(MessageInfo messageInfo) { }
Call methods
// This is the method that enters the chat messages. It passes the channel group, channel name, channel number, and message as arguments.
ChatClient.SendChatMessage(string channelGroup, string channelName, UInt64 channelNumber, string message)
// This is the method that enters the whisper message. It passes the user's name (recipient of the whisper) and message as arguments.
ChatClient.SendWhisperMessage(string gamerName, string message)
Information classes
MESSAGE_TYPE (enum)
Value | Description |
---|---|
SYSTEM_MESSAGE | Admin message |
NORMAL_MESSAGE | General chat message |
public class MessageInfo
{
// Channel group name
public string ChannelGroup = string.Empty;
// Channel name
public string ChannelName = string.Empty;
// Channel number
public UInt64 ChannelNumber = 0;
// User name
public string GamerName = string.Empty;
// Avatar name
public string Avatar = string.Empty;
// Chat index
public UInt64 Index = 0;
// Chat message type
public MESSAGE_TYPE MessageType = MESSAGE_TYPE.NORMAL_MESSAGE;
// Chat message
public string Message = string.Empty;
// Chat time information (UTC) yyyy-MM-dd HH:mm:ss e.g.) 2020-01-01 00:00:00
public string Time = string.Empty;
// Message tag
public string Tag = string.Empty;
}
public class WhisperMessageInfo
{
// Whisper index
public UInt64 Index = 0;
// Whisper sender's user name
public string FromGamerName = string.Empty;
// Whisper sender's user avatar name
public string FromAvatar = string.Empty;
// Whisper message
public string Message = string.Empty;
// Whisper time information (UTC) yyyy-MM-dd HH:mm:ss e.g.) 2020-01-01 00:00:00
public string Time = string.Empty;
// Message tag
public string Tag = string.Empty;
}