Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta484 #489

Merged
merged 39 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
a6ebe57
beta447
Hoshinonyaruko Jun 29, 2024
1d63fae
beta448
Hoshinonyaruko Jul 1, 2024
cd34627
beta449
Hoshinonyaruko Jul 4, 2024
b790b29
beta450
Hoshinonyaruko Jul 4, 2024
7a9b56a
beta451
Hoshinonyaruko Jul 4, 2024
e17d0d4
beta452
Hoshinonyaruko Jul 4, 2024
1318175
beta453
Hoshinonyaruko Jul 4, 2024
b7f291c
beta454
Hoshinonyaruko Jul 4, 2024
f921895
beta455
Hoshinonyaruko Jul 9, 2024
24108c6
btea455
Hoshinonyaruko Jul 9, 2024
7cdc968
beta456
Hoshinonyaruko Jul 9, 2024
b5d784e
beta457
Hoshinonyaruko Jul 9, 2024
61e4001
beta458
Hoshinonyaruko Jul 9, 2024
6d4116a
beta460
Hoshinonyaruko Jul 9, 2024
2c1f1b7
beta460
Hoshinonyaruko Jul 11, 2024
5c312cd
beta461
Hoshinonyaruko Jul 12, 2024
58304eb
beta462
Hoshinonyaruko Jul 13, 2024
7e7c9f3
beta463
Hoshinonyaruko Jul 15, 2024
188f250
beta464
Hoshinonyaruko Jul 15, 2024
af0296d
beta465
Hoshinonyaruko Jul 18, 2024
500135c
beta467
Hoshinonyaruko Jul 21, 2024
c1a588c
beta468
Hoshinonyaruko Jul 21, 2024
1df8e15
beta469
Hoshinonyaruko Jul 21, 2024
f57ab7b
beta470
Hoshinonyaruko Jul 26, 2024
cd21ad9
beta471
Hoshinonyaruko Aug 1, 2024
6039272
beta472
Hoshinonyaruko Aug 1, 2024
c45b450
beta473
Hoshinonyaruko Aug 1, 2024
f89d6c5
beta473
Hoshinonyaruko Aug 3, 2024
b54fdee
beta475
Hoshinonyaruko Aug 5, 2024
a30a697
beta476
Hoshinonyaruko Aug 8, 2024
ab805cc
beta478
Hoshinonyaruko Aug 8, 2024
6debefd
beta479
Hoshinonyaruko Aug 17, 2024
9cc7e5d
beta479
Hoshinonyaruko Aug 17, 2024
c0fe93c
beta480
Hoshinonyaruko Aug 18, 2024
91cf223
beta481
Hoshinonyaruko Aug 18, 2024
a3aa6c1
beta482
Hoshinonyaruko Aug 18, 2024
0917e56
beta483
Hoshinonyaruko Aug 19, 2024
dd1f774
beta484
Hoshinonyaruko Aug 19, 2024
ce0f7e0
Merge branch 'main' into beta484
Hoshinonyaruko Aug 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Processor/ProcessC2CMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (p *Processors) ProcessC2CMessage(data *dto.WSC2CMessageData) error {
//将真实id转为int userid64
_, userid64, err = idmap.StoreIDv2Pro("group_private", data.Author.ID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
//当参数不全
_, _ = idmap.StoreIDv2(data.Author.ID)
Expand All @@ -65,7 +65,7 @@ func (p *Processors) ProcessC2CMessage(data *dto.WSC2CMessageData) error {
//将真实id转为int userid64
userid64, err = idmap.StoreIDv2(data.Author.ID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
}

Expand Down Expand Up @@ -199,7 +199,7 @@ func (p *Processors) ProcessC2CMessage(data *dto.WSC2CMessageData) error {
magic, userid64, err = idmap.StoreIDv2Pro("group_private", data.Author.ID)
mylog.Printf("魔法数字:%v", magic) //690426430
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
//当参数不全,降级时
_, _ = idmap.StoreIDv2(data.Author.ID)
Expand All @@ -209,7 +209,7 @@ func (p *Processors) ProcessC2CMessage(data *dto.WSC2CMessageData) error {
//将真实id转为int userid64
userid64, err = idmap.StoreIDv2(data.Author.ID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
}
//转换at
Expand Down
12 changes: 6 additions & 6 deletions Processor/ProcessChannelDirectMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ func (p *Processors) ProcessChannelDirectMessage(data *dto.WSDirectMessageData)
//将真实id转为int userid64
_, _, err = idmap.StoreIDv2Pro(data.ChannelID, data.Author.ID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
//将真实id转为int userid64
userid64, err = idmap.StoreIDv2(data.Author.ID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
ChannelID64, err = idmap.StoreIDv2(data.ChannelID)
if err != nil {
Expand All @@ -74,7 +74,7 @@ func (p *Processors) ProcessChannelDirectMessage(data *dto.WSDirectMessageData)
//将真实id转为int userid64
userid64, err = idmap.StoreIDv2(data.Author.ID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
//将channelid写入数据库,可取出guild_id
ChannelID64, err = idmap.StoreIDv2(data.ChannelID)
Expand Down Expand Up @@ -299,12 +299,12 @@ func (p *Processors) ProcessChannelDirectMessage(data *dto.WSDirectMessageData)
//将真实id转为int userid64
ChannelID64, userid64, err = idmap.StoreIDv2Pro(data.ChannelID, data.Author.ID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
//将真实id转为int userid64
_, err = idmap.StoreIDv2(data.Author.ID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
_, err = idmap.StoreIDv2(data.ChannelID)
if err != nil {
Expand All @@ -322,7 +322,7 @@ func (p *Processors) ProcessChannelDirectMessage(data *dto.WSDirectMessageData)
//将真实id转为int userid64
userid64, err = idmap.StoreIDv2(data.Author.ID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
//将真实channelid和虚拟做映射
ChannelID64, err = idmap.StoreIDv2(data.ChannelID)
Expand Down
2 changes: 1 addition & 1 deletion Processor/ProcessGroupAddBot.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (p *Processors) ProcessGroupAddBot(data *dto.GroupAddBotEvent) error {
if config.GetIdmapPro() {
GroupID64, userid64, err = idmap.StoreIDv2Pro(data.GroupOpenID, data.OpMemberOpenID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
} else {
GroupID64, err = idmap.StoreIDv2(data.GroupOpenID)
Expand Down
2 changes: 1 addition & 1 deletion Processor/ProcessGroupDelBot.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (p *Processors) ProcessGroupDelBot(data *dto.GroupAddBotEvent) error {
if config.GetIdmapPro() {
GroupID64, userid64, err = idmap.StoreIDv2Pro(data.GroupOpenID, data.OpMemberOpenID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
} else {
GroupID64, err = idmap.StoreIDv2(data.GroupOpenID)
Expand Down
2 changes: 1 addition & 1 deletion Processor/ProcessGroupMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (p *Processors) ProcessGroupMessage(data *dto.WSGroupATMessageData) error {
//将真实id转为int userid64
GroupID64, userid64, err = idmap.StoreIDv2Pro(data.GroupID, data.Author.ID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
//当参数不全
_, _ = idmap.StoreIDv2(data.GroupID)
Expand Down
2 changes: 1 addition & 1 deletion Processor/ProcessGroupMsgReceive.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (p *Processors) ProcessGroupMsgRecive(data *dto.GroupMsgReceiveEvent) error
//将真实id转为int userid64
GroupID64, userid64, err = idmap.StoreIDv2Pro(fromgid, fromuid)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}

// 当哈希碰撞 因为获取时候是用的非idmap的get函数
Expand Down
2 changes: 1 addition & 1 deletion Processor/ProcessGroupMsgReject.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (p *Processors) ProcessGroupMsgReject(data *dto.GroupMsgRejectEvent) error
//将真实id转为int userid64
GroupID64, userid64, err = idmap.StoreIDv2Pro(fromgid, fromuid)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
// 当哈希碰撞 因为获取时候是用的非idmap的get函数
LongGroupID64, _ = idmap.StoreIDv2(fromgid)
Expand Down
2 changes: 1 addition & 1 deletion Processor/ProcessGuildATMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (p *Processors) ProcessGuildATMessage(data *dto.WSATMessageData) error {
//将真实id转为int userid64
ChannelID64, userid64, err = idmap.StoreIDv2Pro(data.ChannelID, data.Author.ID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
//当参数不全时
_, _ = idmap.StoreIDv2(data.ChannelID)
Expand Down
2 changes: 1 addition & 1 deletion Processor/ProcessGuildNormalMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (p *Processors) ProcessGuildNormalMessage(data *dto.WSMessageData) error {
//将真实id转为int userid64
ChannelID64, userid64, err = idmap.StoreIDv2Pro(data.ChannelID, data.Author.ID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
//当参数不全时
_, _ = idmap.StoreIDv2(data.ChannelID)
Expand Down
2 changes: 1 addition & 1 deletion Processor/ProcessInlineSearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (p *Processors) ProcessInlineSearch(data *dto.WSInteractionData) error {
//将真实id转为int userid64
GroupID64, userid64, err = idmap.StoreIDv2Pro(fromgid, fromuid)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
// 当哈希碰撞 因为获取时候是用的非idmap的get函数
LongGroupID64, _ = idmap.StoreIDv2(fromgid)
Expand Down
2 changes: 1 addition & 1 deletion Processor/ProcessThreadMessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func (p *Processors) ProcessThreadMessage(data *dto.WSThreadData) error {
//将真实id转为int userid64
ChannelID64, userid64, err = idmap.StoreIDv2Pro(data.ChannelID, data.AuthorID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
//当参数不全时
_, _ = idmap.StoreIDv2(data.ChannelID)
Expand Down
4 changes: 2 additions & 2 deletions Processor/Processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ func (p *Processors) Autobind(data interface{}) error {
//将真实id转为int userid64
GroupID64, userid64, err = idmap.StoreIDv2Pro(groupID, realID)
if err != nil {
mylog.Fatalf("Error storing ID689: %v", err)
mylog.Errorf("Error storing ID689: %v", err)
}
}
// 单独检查vuin和gid的绑定状态
Expand All @@ -1058,7 +1058,7 @@ func (p *Processors) Autobind(data interface{}) error {
// idmaps pro也更新
err = idmap.UpdateVirtualValuev2Pro(GroupID64, idValue, userid64, vuinValue)
if err != nil {
mylog.Fatalf("Error storing ID703: %v", err)
mylog.Errorf("Error storing ID703: %v", err)
}
} else if !vuinBound {
// 只有vuin未绑定,更新vuin映射
Expand Down
2 changes: 1 addition & 1 deletion handlers/get_friend_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func HandleGetFriendList(client callapi.Client, api openapi.OpenAPI, apiv2 opena
// 从数据库获取所有用户信息
users, err := idmap.ListAllUsers()
if err != nil {
mylog.Fatalf("Failed to list users: %v", err)
mylog.Errorf("Failed to list users: %v", err)
}

// 添加数据库中读取的用户数据到output.Data
Expand Down
2 changes: 1 addition & 1 deletion handlers/get_group_member_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func GetGroupMemberList(client callapi.Client, api openapi.OpenAPI, apiv2 openap
//将真实id转为int userid64
_, userIDInt64, err = idmap.StoreIDv2Pro(message.Params.ChannelID.(string), memberFromAPI.User.ID)
if err != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
} else {
//映射str的userid到int
Expand Down
10 changes: 5 additions & 5 deletions handlers/message_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func SendResponse(client callapi.Client, err error, message *callapi.ActionMessa
//将真实id转为int userid64
GroupID64, _, errr = idmap.StoreIDv2Pro(message.Params.GroupID.(string), message.Params.UserID.(string))
if errr != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
} else {
// 映射str的GroupID到int
Expand All @@ -98,7 +98,7 @@ func SendResponse(client callapi.Client, err error, message *callapi.ActionMessa
//将真实id转为int userid64
channelID64, _, errr = idmap.StoreIDv2Pro(message.Params.ChannelID.(string), message.Params.UserID.(string))
if errr != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
} else {
// 映射str的GroupID到int
Expand All @@ -115,7 +115,7 @@ func SendResponse(client callapi.Client, err error, message *callapi.ActionMessa
//将真实id转为int userid64
guildID64, _, errr = idmap.StoreIDv2Pro(message.Params.GuildID.(string), message.Params.UserID.(string))
if errr != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
} else {
// 映射str的GroupID到int
Expand All @@ -132,7 +132,7 @@ func SendResponse(client callapi.Client, err error, message *callapi.ActionMessa
//将真实id转为int userid64
userID64, _, errr = idmap.StoreIDv2Pro("group_private", message.Params.UserID.(string))
if errr != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
} else {
// 映射str的GroupID到int
Expand Down Expand Up @@ -344,7 +344,7 @@ func SendC2CResponse(client callapi.Client, err error, message *callapi.ActionMe
//将真实id转为int userid64
userid64, errr := idmap.StoreIDv2(message.Params.UserID.(string))
if errr != nil {
mylog.Fatalf("Error storing ID: %v", err)
mylog.Errorf("Error storing ID: %v", err)
}
response.UserID = userid64
response.Echo = message.Echo
Expand Down
6 changes: 3 additions & 3 deletions handlers/send_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,19 +313,19 @@ func GetMessageIDByUseridAndGroupid(appID string, userID interface{}, groupID in
//将真实id转为int userid64
groupid64, userid64, err = idmap.StoreIDv2Pro(GroupIDStr, userIDStr)
if err != nil {
mylog.Fatalf("Error storing ID 210: %v", err)
mylog.Errorf("Error storing ID 210: %v", err)
}
} else {
//将真实id转为int
userid64, err = idmap.StoreIDv2(userIDStr)
if err != nil {
mylog.Fatalf("Error storing ID 241: %v", err)
mylog.Errorf("Error storing ID 241: %v", err)
return ""
}
//将真实id转为int
groupid64, err = idmap.StoreIDv2(GroupIDStr)
if err != nil {
mylog.Fatalf("Error storing ID 256: %v", err)
mylog.Errorf("Error storing ID 256: %v", err)
return ""
}
}
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ func main() {

log.Printf("注册 intents: %v\n", intent)

// 确保p包含conf
p = Processor.NewProcessorV2(api, apiV2, &conf.Settings)

// 启动session manager以管理websocket连接
// 指定需要启动的分片数为 2 的话可以手动修改 wsInfo
if conf.Settings.ShardCount == 1 {
Expand Down
Loading