Skip to content

Commit 957916d

Browse files
committed
light app
1 parent e7c98ec commit 957916d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

service/bot/proto2mirai.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ func ProtoMsgToMiraiMsg(msgList []*onebot.Message, notConvertText bool) []messag
4343
messageChain = append(messageChain, ProtoFaceToMiraiFace(protoMsg.Data))
4444
case "share":
4545
messageChain = append(messageChain, ProtoShareToMiraiShare(protoMsg.Data))
46+
case "light_app":
47+
messageChain = append(messageChain, ProtoLightAppToMiraiLightApp(protoMsg.Data))
4648
default:
4749
log.Errorf("不支持的消息类型 %+v", protoMsg)
4850
}
@@ -153,3 +155,11 @@ func ProtoShareToMiraiShare(data map[string]string) message.IMessageElement {
153155
}
154156
return message.NewUrlShare(url, title, content, image)
155157
}
158+
159+
func ProtoLightAppToMiraiLightApp(data map[string]string) message.IMessageElement {
160+
content, ok := data["content"]
161+
if !ok || content == "" {
162+
return EmptyText()
163+
}
164+
return message.NewLightApp(content)
165+
}

service/bot/raw2mirai.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ func RawMsgToMiraiMsg(str string) []message.IMessageElement {
5959
elemList = append(elemList, ProtoVoiceToMiraiVoice(attrMap))
6060
case "text":
6161
elemList = append(elemList, ProtoTextToMiraiText(attrMap))
62+
case "light_app":
63+
elemList = append(elemList, ProtoLightAppToMiraiLightApp(attrMap))
6264
default:
6365
log.Warnf("不支持的类型 %s", code)
6466
elemList = append(elemList, message.NewText(code))

0 commit comments

Comments
 (0)