Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
KomeiDiSanXian committed Jun 13, 2023
1 parent 8b812fa commit a322776
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
5 changes: 3 additions & 2 deletions plugin/ai_false/ai_false.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"image"
"math"
"math/rand"
"runtime"
"strconv"
"strings"
Expand Down Expand Up @@ -70,7 +71,7 @@ func init() { // 插件主体
}
engine.OnFullMatchGroup([]string{"检查身体", "自检", "启动自检", "系统状态"}, zero.AdminPermission).SetBlock(true).
Handle(func(ctx *zero.Ctx) {
img, err := drawstatus(ctx.State["manager"].(*ctrl.Control[*zero.Ctx]), ctx.Event.SelfID, zero.BotConfig.NickName[0])
img, err := drawstatus(ctx.State["manager"].(*ctrl.Control[*zero.Ctx]), ctx.Event.SelfID, zero.BotConfig.NickName[rand.Intn(len(zero.BotConfig.NickName))])
if err != nil {
ctx.SendChain(message.Text("ERROR: ", err))
return
Expand Down Expand Up @@ -607,7 +608,7 @@ func moreinfo(m *ctrl.Control[*zero.Ctx]) (stateinfo []*status, err error) {
stateinfo = []*status{
{name: "OS", text: []string{ /*hostinfo.Platform*/ "Microsoft Windows ⑨"}},
{name: "CPU", text: []string{cpuinfo[0].ModelName}},
{name: "Version", text: []string{ /*hostinfo.PlatformVersion*/ "99.0.99999.9999 Bulid 99999.9999"}},
{name: "Version", text: []string{ /*hostinfo.PlatformVersion*/ "Maximum number ⑨ Build Crino"}},
{name: "Plugin", text: []string{"共 " + strconv.Itoa(count) + " 个"}},
}
return
Expand Down
6 changes: 0 additions & 6 deletions plugin/bfhelper/bf1/model/playerdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ func (r *PlayerRepository) GetByQID(qid int64) (*Player, error) {

var player Player
if err := r.db.Where("qid = ?", qid).First(&player).Error; err != nil {
if gorm.IsRecordNotFoundError(err) {
return nil, errors.New("Player not found")
}
return nil, err
}
return &player, nil
Expand All @@ -75,9 +72,6 @@ func (r *PlayerRepository) GetByName(name string) (*Player, error) {
}
var player Player
if err := r.db.Where("display_name = ?", name).First(&player).Error; err != nil {
if gorm.IsRecordNotFoundError(err) {
return nil, errors.New("Player not found")
}
return nil, err
}
return &player, nil
Expand Down
2 changes: 1 addition & 1 deletion plugin/bfhelper/request/bf1/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Post struct {
// Param parameters
type Param struct {
Game string `json:"game"`
PersonaID string `json:"personaID"`
PersonaID string `json:"personaId"`
PersonaIds []string `json:"personaIds"`
GameID string `json:"gameID"`
ServerID string `json:"serverID"`
Expand Down
2 changes: 1 addition & 1 deletion plugin/bfhelper/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func ID2PID(qid int64, id string) (string, string, error) {
}
// 若绑定账号时未获取到pid,重新获取并写入数据库
if data.PersonalID == "" {
pid, err := api.GetPersonalID(id)
pid, err := api.GetPersonalID(data.DisplayName)
if err != nil {
return "", id, errors.New("获取pid失败,请重试")
}
Expand Down

0 comments on commit a322776

Please sign in to comment.