您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
36 行
1.0 KiB
36 行
1.0 KiB
using System.Collections.Generic;
|
|
|
|
namespace ChatComponents
|
|
{
|
|
public class PartialText
|
|
{
|
|
/// User's message
|
|
public readonly string text;
|
|
|
|
/// Creates a partial text message with all variables text can have.
|
|
/// Use [TextMessage] to create a full message.
|
|
/// You can use [TextMessage.fromPartial] constructor to create a full
|
|
/// message from a partial one.
|
|
public PartialText(
|
|
string text
|
|
)
|
|
{
|
|
this.text = text;
|
|
}
|
|
|
|
/// Creates a partial text message from a map (decoded JSON).
|
|
private PartialText fromJson(Dictionary<string, object> json)
|
|
{
|
|
return new PartialText(json["text"] as string);
|
|
}
|
|
|
|
/// Converts a partial text message to the map representation, encodable to JSON.
|
|
private Dictionary<string, object> toJson()
|
|
{
|
|
return new Dictionary<string, object>
|
|
{
|
|
{"text", text}
|
|
};
|
|
}
|
|
}
|
|
}
|