mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-07-03 21:03:25 +00:00
Compare commits
2 Commits
7fdb04c902
...
d89d21d0b6
Author | SHA1 | Date | |
---|---|---|---|
d89d21d0b6 | |||
7727819c92 |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -43,7 +43,7 @@ jobs:
|
||||
export LD_FLAGS="-w -s -X github.com/Mrs4s/go-cqhttp/internal/base.Version=${COMMIT_ID::7}"
|
||||
go build -o "output/$BINARY_NAME" -trimpath -ldflags "$LD_FLAGS" .
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
if: ${{ !github.head_ref }}
|
||||
with:
|
||||
name: ${{ matrix.goos }}_${{ matrix.goarch }}
|
||||
|
@ -85,7 +85,7 @@ func NewQQBot(cli *client.QQClient) *CQBot {
|
||||
bot.Client.SelfPrivateMessageEvent.Subscribe(bot.privateMessageEvent)
|
||||
bot.Client.SelfGroupMessageEvent.Subscribe(bot.groupMessageEvent)
|
||||
}
|
||||
//bot.Client.TempMessageEvent.Subscribe(bot.tempMessageEvent)
|
||||
bot.Client.TempMessageEvent.Subscribe(bot.tempMessageEvent)
|
||||
bot.Client.GroupMuteEvent.Subscribe(bot.groupMutedEvent)
|
||||
bot.Client.GroupRecallEvent.Subscribe(bot.groupRecallEvent)
|
||||
bot.Client.GroupNotifyEvent.Subscribe(bot.groupNotifyEvent)
|
||||
@ -103,7 +103,7 @@ func NewQQBot(cli *client.QQClient) *CQBot {
|
||||
//bot.Client.MemberCardUpdatedEvent.Subscribe(bot.memberCardUpdatedEvent)
|
||||
bot.Client.NewFriendRequestEvent.Subscribe(bot.friendRequestEvent)
|
||||
// TODO 成为好友
|
||||
//bot.Client.NewFriendEvent.Subscribe(bot.friendAddedEvent)
|
||||
bot.Client.NewFriendEvent.Subscribe(bot.friendAddedEvent)
|
||||
bot.Client.GroupInvitedEvent.Subscribe(bot.groupInvitedEvent)
|
||||
bot.Client.GroupMemberJoinRequestEvent.Subscribe(bot.groupJoinReqEvent)
|
||||
// TODO 客户端变更
|
||||
|
@ -140,43 +140,41 @@ func (bot *CQBot) groupMessageEvent(_ *client.QQClient, m *message.GroupMessage)
|
||||
bot.dispatch(gm)
|
||||
}
|
||||
|
||||
// TODO 暂不支持临时会话
|
||||
/*
|
||||
func (bot *CQBot) tempMessageEvent(_ *client.QQClient, e *client.TempMessageEvent) {
|
||||
m := e.Message
|
||||
bot.checkMedia(m.Elements, m.Sender.Uin)
|
||||
func (bot *CQBot) tempMessageEvent(_ *client.QQClient, e *message.TempMessage) {
|
||||
source := message.Source{
|
||||
SourceType: message.SourcePrivate,
|
||||
PrimaryID: e.Session.Sender,
|
||||
}
|
||||
cqm := toStringMessage(m.Elements, source)
|
||||
if base.AllowTempSession {
|
||||
bot.tempSessionCache.Store(m.Sender.Uin, e.Session)
|
||||
PrimaryID: int64(e.Sender.Uin),
|
||||
}
|
||||
bot.checkMedia(e.Elements, source)
|
||||
|
||||
id := m.Id
|
||||
cqm := toStringMessage(e.Elements, source)
|
||||
//if base.AllowTempSession {
|
||||
// bot.tempSessionCache.Store(e.Sender.Uin, e.Session)
|
||||
//}
|
||||
|
||||
id := e.ID
|
||||
// todo(Mrs4s)
|
||||
// if bot.db != nil { // nolint
|
||||
// id = bot.InsertTempMessage(m.Sender.Uin, m)
|
||||
// }
|
||||
log.Infof("收到来自群 %v(%v) 内 %v(%v) 的临时会话消息: %v", m.GroupName, m.GroupCode, m.Sender.DisplayName(), m.Sender.Uin, cqm)
|
||||
log.Infof("收到来自群 %v(%v) 内 %v(%v) 的临时会话消息: %v", e.GroupName, e.GroupName, e.Sender.Nickname, e.Sender.Uin, cqm)
|
||||
tm := global.MSG{
|
||||
"temp_source": e.Session.Source,
|
||||
//"temp_source": e.Session.Source,
|
||||
"message_id": id,
|
||||
"user_id": m.Sender.Uin,
|
||||
"message": ToFormattedMessage(m.Elements, source),
|
||||
"user_id": e.Sender.Uin,
|
||||
"message": ToFormattedMessage(e.Elements, source),
|
||||
"raw_message": cqm,
|
||||
"font": 0,
|
||||
"sender": global.MSG{
|
||||
"user_id": m.Sender.Uin,
|
||||
"group_id": m.GroupCode,
|
||||
"nickname": m.Sender.Nickname,
|
||||
"user_id": e.Sender.Uin,
|
||||
"group_id": e.GroupUin,
|
||||
"nickname": e.Sender.Nickname,
|
||||
"sex": "unknown",
|
||||
"age": 0,
|
||||
},
|
||||
}
|
||||
bot.dispatchEvent("message/private/group", tm)
|
||||
}*/
|
||||
}
|
||||
|
||||
func (bot *CQBot) groupMutedEvent(c *client.QQClient, e *event2.GroupMute) {
|
||||
g := c.GetCachedGroupInfo(e.GroupUin)
|
||||
@ -235,8 +233,6 @@ func (bot *CQBot) groupRecallEvent(c *client.QQClient, e *event2.GroupRecall) {
|
||||
bot.dispatch(ev)
|
||||
}
|
||||
|
||||
//TODO 群通知
|
||||
|
||||
func (bot *CQBot) groupNotifyEvent(c *client.QQClient, e event2.INotifyEvent) {
|
||||
group := c.GetCachedGroupInfo(e.From())
|
||||
// TODO more event
|
||||
@ -413,13 +409,13 @@ func (bot *CQBot) friendRequestEvent(_ *client.QQClient, e *event2.NewFriendRequ
|
||||
})
|
||||
}
|
||||
|
||||
//func (bot *CQBot) friendAddedEvent(_ *client.QQClient, e *client.NewFriendEvent) {
|
||||
// log.Infof("添加了新好友: %v(%v)", e.Friend.Nickname, e.Friend.Uin)
|
||||
// bot.tempSessionCache.Delete(e.Friend.Uin)
|
||||
// bot.dispatchEvent("notice/friend_add", global.MSG{
|
||||
// "user_id": e.Friend.Uin,
|
||||
// })
|
||||
//}
|
||||
func (bot *CQBot) friendAddedEvent(_ *client.QQClient, e *event2.NewFriend) {
|
||||
log.Infof("添加了新好友: %v(%v)", e.FromNick, e.FromUin)
|
||||
//bot.tempSessionCache.Delete(e.Friend.Uin)
|
||||
bot.dispatchEvent("notice/friend_add", global.MSG{
|
||||
"user_id": e.FromUin,
|
||||
})
|
||||
}
|
||||
|
||||
func (bot *CQBot) groupInvitedEvent(_ *client.QQClient, e *event2.GroupInvite) {
|
||||
log.Infof("收到来自群 %v(%v) 内用户 %v(%v) 的加群邀请.", e.GroupName, e.GroupUin, e.InvitorNick, e.InvitorUin)
|
||||
|
2
go.mod
2
go.mod
@ -4,7 +4,7 @@ go 1.20
|
||||
|
||||
require (
|
||||
github.com/FloatTech/sqlite v1.6.3
|
||||
github.com/LagrangeDev/LagrangeGo v0.1.2
|
||||
github.com/LagrangeDev/LagrangeGo v0.1.3-0.20241128062531-bea32754985f
|
||||
github.com/Microsoft/go-winio v0.6.2-0.20230724192519-b29bbd58a65a
|
||||
github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7
|
||||
github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5
|
||||
|
4
go.sum
4
go.sum
@ -2,8 +2,8 @@ github.com/FloatTech/sqlite v1.6.3 h1:MQkqBNlkPuCoKQQgoNLuTL/2Ci3tBTFAnVYBdD0Wy4
|
||||
github.com/FloatTech/sqlite v1.6.3/go.mod h1:zFbHzRfB+CJ+VidfjuVbrcin3DAz283F7hF1hIeHzpY=
|
||||
github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1 h1:g4pTnDJUW4VbJ9NvoRfUvdjDrHz/6QhfN/LoIIpICbo=
|
||||
github.com/FloatTech/ttl v0.0.0-20230307105452-d6f7b2b647d1/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
|
||||
github.com/LagrangeDev/LagrangeGo v0.1.2 h1:owH3gSZRTmW1qRuLsdkZsaBjyijKQUaJnLoui5XaTq0=
|
||||
github.com/LagrangeDev/LagrangeGo v0.1.2/go.mod h1:m7ydyvA8DKOg5c6iTFDfNtfIK9uhqXVJKRXl4mlGkTA=
|
||||
github.com/LagrangeDev/LagrangeGo v0.1.3-0.20241128062531-bea32754985f h1:arXQxi9PrzbK3d2dw9xvRFkn9jMqqd0dwziwO24dMhg=
|
||||
github.com/LagrangeDev/LagrangeGo v0.1.3-0.20241128062531-bea32754985f/go.mod h1:m7ydyvA8DKOg5c6iTFDfNtfIK9uhqXVJKRXl4mlGkTA=
|
||||
github.com/Microsoft/go-winio v0.6.2-0.20230724192519-b29bbd58a65a h1:aU1703IHxupjzipvhu16qYKLMR03e+8WuNR+JMsKfGU=
|
||||
github.com/Microsoft/go-winio v0.6.2-0.20230724192519-b29bbd58a65a/go.mod h1:OZqLNXdYJHmx7aqq/T6wAdFEdoGm5nmIfC4kU7M8P8o=
|
||||
github.com/RomiChan/protobuf v0.1.1-0.20230204044148-2ed269a2e54d h1:/Xuj3fIiMY2ls1TwvPKmaqQrtJsPY+c9s+0lOScVHd8=
|
||||
|
Reference in New Issue
Block a user