public final class TextMessage extends Object
Constructor and Description |
---|
TextMessage(org.json.simple.JSONObject object)
Construct a chat message from a JSON structure.
|
TextMessage(String text)
Construct a new chat message from a simple text string.
|
Modifier and Type | Method and Description |
---|---|
String |
asPlaintext()
Attempt to convert the message to its plaintext representation.
|
static TextMessage |
decode(String json)
Decode a chat message from its textual JSON representation if possible.
|
String |
encode()
Encode this chat message to its textual JSON representation.
|
boolean |
equals(Object o) |
String |
flatten()
Flatten this message to an approximate old-style string representation.
|
int |
hashCode() |
String |
toString() |
public TextMessage(String text)
text
- The text of the message.public TextMessage(org.json.simple.JSONObject object)
object
- The JSON structure of the message.public String flatten()
public static TextMessage decode(String json)
json
- The encoded representation.public String encode()
public String asPlaintext()
Copyright © 2021. All rights reserved.