File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -159,7 +159,10 @@ anyhow = "1.0"
159159use sithra_kit :: {
160160 plugin :: Plugin ,
161161 server :: extract :: payload :: Payload ,
162- types :: message :: {Message , SendMessage , common :: CommonSegment },
162+ types :: {
163+ message :: {Message , SendMessage , common :: CommonSegment as H },
164+ smsg,
165+ },
163166};
164167
165168/// 插件入口点
@@ -184,7 +187,7 @@ async fn main() {
184187/// 处理 echo 命令的函数
185188///
186189/// 当收到以 "echo " 开头的消息时,返回去掉 "echo " 前缀的内容
187- async fn echo (Payload (msg ): Payload <Message <CommonSegment >>) -> Option <SendMessage > {
190+ async fn echo (Payload (msg ): Payload <Message <H >>) -> Option <SendMessage > {
188191 // 1. 消息是否为文本开头,如果是则获取文本,否则返回 None
189192 let text = msg . content. first ()? . text_opt ()? ;
190193
@@ -200,11 +203,11 @@ async fn echo(Payload(msg): Payload<Message<CommonSegment>>) -> Option<SendMessa
200203 // 5. 修改原始消息内容
201204 {
202205 let first = content . first_mut ()? ;
203- * first = CommonSegment :: text (& text );
206+ * first = H :: text (& text );
204207 }
205208
206209 // 6. 返回要发送的消息
207- Some (SendMessage :: new (content ))
210+ Some (smsg! (content ))
208211}
209212```
210213
You can’t perform that action at this time.
0 commit comments