Skip to content

Commit

Permalink
fix: sign result use image
Browse files Browse the repository at this point in the history
  • Loading branch information
RicheyJang committed Mar 16, 2022
1 parent 7fcfad3 commit 7235000
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions plugins/genshin/genshin_sign/auto.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"
"time"

"github.com/RicheyJang/PaimengBot/utils/images"
"github.com/RicheyJang/PaimengBot/utils/push"

"github.com/fsnotify/fsnotify"
Expand Down Expand Up @@ -109,13 +110,13 @@ func autoSignTask() {
groupID, _ := strconv.ParseInt(user.EventFrom.FromId, 10, 64)
qq, _ := strconv.ParseInt(k, 10, 64)
push.Send(push.Target{
Msg: message.Message{message.At(qq), message.Text(msg)},
Msg: message.Message{message.At(qq), images.GenStringMsg(msg)},
Groups: []int64{groupID},
})
} else if !user.EventFrom.IsFromGroup { // 来自个人的定时签到
qq, _ := strconv.ParseInt(k, 10, 64)
push.Send(push.Target{
Msg: message.Message{message.Text(msg)},
Msg: message.Message{images.GenStringMsg(msg)},
Friends: []int64{qq},
})
}
Expand Down
8 changes: 4 additions & 4 deletions plugins/genshin/genshin_sign/public.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ func Sign(uid string, cookie string) (string, error) {
}
// 米游社签到
if err = mihoyo.Sign(cookie, *gameRole); err != nil { // 签到失败
msg := fmt.Sprintf("UID:%v, 昵称:%v: 米游社签到失败",
msg := fmt.Sprintf("UID:%v, 昵称:%v\n米游社签到失败",
gameRole.Uid, gameRole.NickName)
return msg, err
}
// 签到成功
msg := fmt.Sprintf("UID:%v, 昵称:%v: 米游社签到成功", gameRole.Uid, gameRole.NickName)
msg := fmt.Sprintf("UID:%v, 昵称:%v\n米游社签到成功", gameRole.Uid, gameRole.NickName)
// 查询签到信息
data, err := mihoyo.GetSignStateInfo(cookie, *gameRole)
if err != nil {
log.Warnf("GetSignStateInfo err: %v", err)
return msg, nil
}
msg += fmt.Sprintf(", 已连续签到%v天", data.TotalSignDay)
msg += fmt.Sprintf("\n已连续签到%v天", data.TotalSignDay)
// 查询奖励信息
awards, err := mihoyo.GetSignAwardsList()
if err != nil {
Expand All @@ -38,7 +38,7 @@ func Sign(uid string, cookie string) (string, error) {
}
if len(awards.Awards) >= data.TotalSignDay {
item := awards.Awards[data.TotalSignDay-1]
msg += fmt.Sprintf(", 今天获得%d个%v", item.Count, item.Name)
msg += fmt.Sprintf("\n今天获得%d个%v", item.Count, item.Name)
}
return msg, nil
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/genshin/genshin_sign/sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func singleSignHandler(ctx *zero.Ctx) {
if err != nil {
log.Errorf("Sign(uid=%v) err: %v", userUid, err)
}
ctx.Send(msg)
ctx.Send(images.GenStringMsg(msg))
}

func checkCouldGroup(ctx *zero.Ctx) bool {
Expand Down

0 comments on commit 7235000

Please sign in to comment.