Skip to content

Commit

Permalink
fix: 修复接收频道 at 消息时 at 内 id 与机器人 id 不符的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
WindowsSov8forUs committed Oct 10, 2024
1 parent 9d9a00e commit 898430f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions processor/message_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,13 @@ func ConvertToMessageContent(data interface{}) string {
id := strings.TrimPrefix(strings.TrimSuffix(r, ">"), "<@!")
for _, mention := range msg.Mentions {
if mention.ID == id {
// 如果是机器人自己则进行替换
//
// 这种时候一般来说都是频道
if id == SelfId {
id = GetBot("qqguild").Id
}

at := satoriMessage.MessageElementAt{
Id: mention.ID,
Name: mention.Username,
Expand Down
3 changes: 3 additions & 0 deletions server/httpapi/login_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ func HandleLoginGet(api, apiv2 openapi.OpenAPI, message *ActionMessage) (any, AP
return gin.H{}, &InternalServerError{err}
}

// 更新 SelfID
processor.SelfId = me.ID

// 构建机器人对象
bot := &user.User{
Id: processor.GetBot(message.Platform).Id,
Expand Down

0 comments on commit 898430f

Please sign in to comment.