onebot_api/message/
send_segment.rs

1use serde::Serialize;
2
3#[derive(Serialize, Debug, Clone)]
4#[serde(tag = "type")]
5pub enum SendSegment {
6	#[serde(rename = "text")]
7	Text { data: TextData },
8
9	#[serde(rename = "face")]
10	Face { data: FaceData },
11
12	#[serde(rename = "image")]
13	Image { data: ImageData },
14
15	#[serde(rename = "record")]
16	Record { data: RecordData },
17
18	#[serde(rename = "video")]
19	Video { data: VideoData },
20
21	#[serde(rename = "at")]
22	At { data: AtData },
23
24	#[serde(rename = "rps")]
25	Rps { data: RpsData },
26
27	#[serde(rename = "dice")]
28	Dice { data: DiceData },
29
30	#[serde(rename = "shake")]
31	Shake { data: ShakeData },
32
33	#[serde(rename = "poke")]
34	Poke { data: PokeData },
35
36	#[serde(rename = "anonymous")]
37	Anonymous { data: AnonymousData },
38
39	#[serde(rename = "share")]
40	Share { data: ShareData },
41
42	#[serde(rename = "contact")]
43	Contact { data: ContactData },
44
45	#[serde(rename = "location")]
46	Location { data: LocationData },
47
48	#[serde(rename = "music")]
49	Music { data: MusicData },
50
51	#[serde(rename = "reply")]
52	Reply { data: ReplyData },
53
54	#[serde(rename = "forward")]
55	Forward { data: ForwardData },
56
57	#[serde(rename = "node")]
58	Node { data: NodeData },
59
60	#[serde(rename = "xml")]
61	Xml { data: XmlData },
62
63	#[serde(rename = "json")]
64	Json { data: JsonData },
65}
66
67#[derive(Serialize, Debug, Clone)]
68pub struct TextData {
69	pub text: String,
70}
71
72#[derive(Serialize, Debug, Clone)]
73pub struct FaceData {
74	pub id: String,
75}
76
77#[derive(Serialize, Debug, Clone)]
78pub struct ImageData {
79	pub file: String,
80	#[serde(rename = "type")]
81	pub image_type: Option<String>,
82	pub cache: Option<bool>,
83	pub proxy: Option<bool>,
84	pub timeout: Option<bool>,
85}
86
87#[derive(Serialize, Debug, Clone)]
88pub struct RecordData {
89	pub file: String,
90	pub magic: String,
91	pub cache: Option<bool>,
92	pub proxy: Option<bool>,
93	pub timeout: Option<bool>,
94}
95
96#[derive(Serialize, Debug, Clone)]
97pub struct VideoData {
98	pub file: String,
99	pub cache: Option<bool>,
100	pub proxy: Option<bool>,
101	pub timeout: Option<bool>,
102}
103
104#[derive(Serialize, Debug, Clone)]
105pub struct AtData {
106	pub qq: String,
107}
108
109#[derive(Serialize, Debug, Clone)]
110pub struct RpsData {}
111
112#[derive(Serialize, Debug, Clone)]
113pub struct DiceData {}
114
115#[derive(Serialize, Debug, Clone)]
116pub struct ShakeData {}
117
118#[derive(Serialize, Debug, Clone)]
119pub struct PokeData {
120	#[serde(rename = "type")]
121	pub poke_type: String,
122	pub id: String,
123}
124
125#[derive(Serialize, Debug, Clone)]
126pub struct AnonymousData {
127	pub ignore: Option<bool>,
128}
129
130#[derive(Serialize, Debug, Clone)]
131pub struct ShareData {
132	pub url: String,
133	pub title: String,
134	pub content: String,
135	pub image: String,
136}
137
138#[derive(Serialize, Debug, Clone)]
139pub struct ContactData {
140	#[serde(rename = "type")]
141	pub contact_type: String,
142	pub id: String,
143}
144
145#[derive(Serialize, Debug, Clone)]
146pub struct LocationData {
147	pub lat: String,
148	pub lon: String,
149	pub title: Option<String>,
150	pub content: Option<String>,
151}
152
153#[derive(Serialize, Debug, Clone)]
154pub struct MusicData {
155	#[serde(rename = "type")]
156	pub music_type: String,
157	pub id: Option<String>,
158	pub url: Option<String>,
159	pub audio: Option<String>,
160	pub title: Option<String>,
161	pub content: Option<String>,
162	pub image: Option<String>,
163}
164
165#[derive(Serialize, Debug, Clone)]
166pub struct ReplyData {
167	pub id: String,
168}
169
170#[derive(Serialize, Debug, Clone)]
171pub struct ForwardData {}
172
173#[derive(Serialize, Debug, Clone)]
174pub struct NodeData {
175	pub id: Option<String>,
176	pub user_id: Option<String>,
177	pub nickname: Option<String>,
178	pub content: Option<Vec<SendSegment>>,
179}
180
181#[derive(Serialize, Debug, Clone)]
182pub struct XmlData {
183	pub data: String,
184}
185
186#[derive(Serialize, Debug, Clone)]
187pub struct JsonData {
188	pub data: String,
189}