Skip to content

Commit

Permalink
增加查询绑定功能
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteReimu committed Aug 4, 2024
1 parent 7ba345b commit 69faa87
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions maplebot/bots.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,20 @@ func handleGroupMessage(message *GroupMessage) bool {
}
}
return true
} else if strings.HasPrefix(text.Text, "查询绑定 ") {
qqNumber := strings.TrimSpace(text.Text[len("查询绑定"):])
qq, err := strconv.ParseInt(qqNumber, 10, 64)
if err != nil {
sendGroupMessage(message, &Text{Text: "命令格式:“查询绑定 QQ号”"})
return true
}
data := findRoleData.GetStringMapString("data")
if name := data[strconv.FormatInt(qq, 10)]; name != "" {
sendGroupMessage(message, &Text{Text: "该玩家绑定了:" + name})
} else {
sendGroupMessage(message, &Text{Text: "该玩家还未绑定"})
}
return true
} else if strings.HasPrefix(text.Text, "绑定 ") {
data := findRoleData.GetStringMapString("data")
if data[strconv.FormatInt(message.Sender.UserId, 10)] != "" {
Expand Down

0 comments on commit 69faa87

Please sign in to comment.