Skip to content

Commit 374ab4c

Browse files
committed
go up
1 parent 8a88877 commit 374ab4c

File tree

6 files changed

+14
-63
lines changed

6 files changed

+14
-63
lines changed

go.mod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/ProtobufBot/Go-Mirai-Client
33
go 1.17
44

55
require (
6-
github.com/Mrs4s/MiraiGo v0.0.0-20211101184540-c518dfcf1557
6+
github.com/Mrs4s/MiraiGo v0.0.0-20211208080234-25c67a3ee1c1
77
github.com/fanliao/go-promise v0.0.0-20141029170127-1890db352a72
88
github.com/gin-gonic/gin v1.7.2
99
github.com/go-playground/validator/v10 v10.8.0 // indirect
@@ -22,19 +22,21 @@ require (
2222
github.com/smartystreets/goconvey v1.6.4 // indirect
2323
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816
2424
github.com/zserge/lorca v0.1.10
25-
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f // indirect
25+
golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9 // indirect
2626
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
2727
google.golang.org/protobuf v1.27.1 // indirect
2828
gopkg.in/yaml.v2 v2.4.0 // indirect
2929
)
3030

3131
require (
32+
github.com/RomiChan/protobuf v0.0.0-20211204042931-ff4f35848737 // indirect
3233
github.com/gin-contrib/sse v0.1.0 // indirect
3334
github.com/go-playground/locales v0.13.0 // indirect
3435
github.com/go-playground/universal-translator v0.17.0 // indirect
3536
github.com/klauspost/compress v1.13.6 // indirect
3637
github.com/leodido/go-urn v1.2.1 // indirect
3738
github.com/modern-go/reflect2 v1.0.1 // indirect
39+
github.com/pierrec/lz4/v4 v4.1.11 // indirect
3840
github.com/tidwall/gjson v1.11.0 // indirect
3941
github.com/tidwall/match v1.1.1 // indirect
4042
github.com/tidwall/pretty v1.2.0 // indirect

go.sum

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
github.com/Mrs4s/MiraiGo v0.0.0-20211101184540-c518dfcf1557 h1:blGra4HstFen44JST+/ZyklvJRfTqHbsT1zjztbcyyE=
2-
github.com/Mrs4s/MiraiGo v0.0.0-20211101184540-c518dfcf1557/go.mod h1:imVKbfKqqeit+C/eaWGb4MKQ3z3gN6pRpBU5RMtp5so=
1+
github.com/Mrs4s/MiraiGo v0.0.0-20211208080234-25c67a3ee1c1 h1:UipCzEST10GzJnvlhHsY4g39xzwVzSHE+5Go9d0dTPY=
2+
github.com/Mrs4s/MiraiGo v0.0.0-20211208080234-25c67a3ee1c1/go.mod h1:YD9gBKkxC9lPPtx3doYXRG26VBkK6YXjrS76cv01C5w=
3+
github.com/RomiChan/protobuf v0.0.0-20211204042931-ff4f35848737 h1:p4o7/eSoP39jwnGZz08N1IpH/mNzg9SdCn7kPM9A9BE=
4+
github.com/RomiChan/protobuf v0.0.0-20211204042931-ff4f35848737/go.mod h1:CKKOWC7mBxd36zxsCB1V8DTrwlTNRQvkSVbYqyUiGEE=
35
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
46
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
57
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -59,6 +61,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ
5961
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
6062
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
6163
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
64+
github.com/pierrec/lz4/v4 v4.1.11 h1:LVs17FAZJFOjgmJXl9Tf13WfLUvZq7/RjfEJrnwZ9OE=
65+
github.com/pierrec/lz4/v4 v4.1.11/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
6266
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
6367
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
6468
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@@ -78,8 +82,9 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
7882
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
7983
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
8084
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
81-
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
8285
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
86+
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
87+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
8388
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 h1:J6v8awz+me+xeb/cUTotKgceAYouhIB3pjzgRd6IlGk=
8489
github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816/go.mod h1:tzym/CEb5jnFI+Q0k4Qq3+LvRF4gO3E2pxS8fHP8jcA=
8590
github.com/tidwall/gjson v1.11.0 h1:C16pk7tQNiH6VlCrtIXL1w8GaOsi1X3W8KDkE1BuYd4=
@@ -104,8 +109,8 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn
104109
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
105110
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
106111
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
107-
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f h1:OfiFi4JbukWwe3lzw+xunroH1mnC1e2Gy5cxNJApiSY=
108-
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
112+
golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9 h1:0qxwC5n+ttVOINCBeRHO0nq9X7uy8SDsPoi5OaCdIEI=
113+
golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
109114
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
110115
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
111116
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

pkg/bot/api_handler.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,6 @@ func preProcessGroupSendingMessage(cli *client.QQClient, groupCode int64, m *mes
141141
newElements = append(newElements, gm)
142142
continue
143143
}
144-
if i, ok := element.(*clz.GiftElement); ok {
145-
cli.SendGroupGift(uint64(groupCode), uint64(i.Target), i.GiftId)
146-
continue
147-
}
148144
newElements = append(newElements, element)
149145
}
150146
m.Elements = newElements

pkg/bot/proto2mirai.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ func ProtoMsgToMiraiMsg(cli *client.QQClient, msgList []*onebot.Message, notConv
7272
messageChain = append(messageChain, ProtoTtsToMiraiTts(cli, protoMsg.Data))
7373
case "video":
7474
messageChain = append(messageChain, ProtoVideoToMiraiVideo(cli, protoMsg.Data))
75-
case "gift":
76-
messageChain = append(messageChain, ProtoGiftToMiraiGift(cli, protoMsg.Data))
7775
default:
7876
log.Errorf("不支持的消息类型 %+v", protoMsg)
7977
}
@@ -427,42 +425,3 @@ func ProtoVideoToMiraiVideo(cli *client.QQClient, data map[string]string) (m mes
427425
elem.CoverUrl = coverUrl // 仅用于发送日志展示
428426
return elem
429427
}
430-
431-
func ProtoGiftToMiraiGift(cli *client.QQClient, data map[string]string) message.IMessageElement {
432-
qq, err := strconv.ParseInt(data["qq"], 10, 64)
433-
if err != nil {
434-
log.Warnf("failed to get gift target, %s", data["qq"])
435-
return EmptyText()
436-
}
437-
giftId, err := strconv.Atoi(data["id"])
438-
if err != nil {
439-
log.Warnf("failed to get gift id, %s", data["qq"])
440-
return EmptyText()
441-
}
442-
freeGifts := []message.GroupGift{ // 免费礼物
443-
message.SweetWink,
444-
message.HappyCola,
445-
message.LuckyBracelet,
446-
message.Cappuccino,
447-
message.CatWatch,
448-
message.FleeceGloves,
449-
message.RainbowCandy,
450-
message.Stronger,
451-
message.LoveMicrophone,
452-
message.HoldingYourHand,
453-
message.CuteCat,
454-
message.MysteryMask,
455-
message.ImBusy,
456-
message.LoveMask,
457-
}
458-
for _, freeGift := range freeGifts {
459-
if int(freeGift) == giftId {
460-
return &clz.GiftElement{
461-
Target: qq,
462-
GiftId: freeGift,
463-
}
464-
}
465-
}
466-
log.Warnf("unsupported gift: %+v, free gift list: %+v", giftId, util.MustMarshal(freeGifts))
467-
return EmptyText()
468-
}

pkg/bot/raw2mirai.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ func RawMsgToMiraiMsg(cli *client.QQClient, str string) []message.IMessageElemen
8080
elemList = append(elemList, ProtoTtsToMiraiTts(cli, attrMap))
8181
case "video":
8282
elemList = append(elemList, ProtoVideoToMiraiVideo(cli, attrMap))
83-
case "gift":
84-
elemList = append(elemList, ProtoGiftToMiraiGift(cli, attrMap))
8583
default:
8684
log.Warnf("不支持的类型 %s", code)
8785
elemList = append(elemList, message.NewText(code))

pkg/clz/clz.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@ func (m *LocalImageElement) Type() message.ElementType {
2626
return message.Image
2727
}
2828

29-
type GiftElement struct {
30-
Target int64
31-
GiftId message.GroupGift
32-
}
33-
34-
func (g *GiftElement) Type() message.ElementType {
35-
return message.At
36-
}
37-
3829
type PokeElement struct {
3930
Target int64
4031
}

0 commit comments

Comments
 (0)