Skip to content

Commit

Permalink
Beta484 (#489)
Browse files Browse the repository at this point in the history
* beta447

* beta448

* beta449

* beta450

* beta451

* beta452

* beta453

* beta454

* beta455

* btea455

* beta456

* beta457

* beta458

* beta460

* beta460

* beta461

* beta462

* beta463

* beta464

* beta465

* beta467

* beta468

* beta469

* beta470

* beta471

* beta472

* beta473

* beta473

* beta475

* beta476

* beta478

* beta479

* beta479

* beta480

* beta481

* beta482

* beta483

* beta484
  • Loading branch information
Hoshinonyaruko authored Aug 19, 2024
1 parent 2561d65 commit 6f4deeb
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 31 deletions.
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

0 comments on commit 6f4deeb

Please sign in to comment.