🎨 改进代码样式 (#569)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2023-01-31 16:27:43 +08:00 committed by GitHub
parent faf00dfea7
commit 76e7f81a6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 56 additions and 60 deletions

View File

@ -1,9 +1,10 @@
package warframeapi package warframeapi
import ( import (
"github.com/davidscholberg/go-durationfmt"
"sync" "sync"
"time" "time"
"github.com/davidscholberg/go-durationfmt"
) )
// 游戏时间模拟 // 游戏时间模拟

View File

@ -4,6 +4,13 @@ package warframeapi
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"net/http"
"sort"
"strconv"
"strings"
"sync"
"time"
"github.com/FloatTech/floatbox/binary" "github.com/FloatTech/floatbox/binary"
"github.com/FloatTech/floatbox/web" "github.com/FloatTech/floatbox/web"
ctrl "github.com/FloatTech/zbpctrl" ctrl "github.com/FloatTech/zbpctrl"
@ -12,12 +19,6 @@ import (
"github.com/lithammer/fuzzysearch/fuzzy" "github.com/lithammer/fuzzysearch/fuzzy"
zero "github.com/wdvxdr1123/ZeroBot" zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/message" "github.com/wdvxdr1123/ZeroBot/message"
"net/http"
"sort"
"strconv"
"strings"
"sync"
"time"
) )
var ( var (
@ -90,7 +91,6 @@ func init() {
rt.enable = false rt.enable = false
rt.rwm.Unlock() rt.rwm.Unlock()
}() }()
} }
}) })
eng.OnFullMatch("警报").SetBlock(true). eng.OnFullMatch("警报").SetBlock(true).
@ -113,11 +113,9 @@ func init() {
"奖励:" + v.Mission.Reward.AsString, "奖励:" + v.Mission.Reward.AsString,
"剩余时间:" + v.Eta, "剩余时间:" + v.Eta,
})) }))
} }
} }
} }
}) })
//TODO:订阅功能-等待重做 //TODO:订阅功能-等待重做
// eng.OnRegex(`^(订阅|取消订阅)(.*)平原(.*)$`).SetBlock(true). // eng.OnRegex(`^(订阅|取消订阅)(.*)平原(.*)$`).SetBlock(true).
@ -409,7 +407,6 @@ func itemNameFutureEvent(ctx *zero.Ctx, count int) int {
ctx.SendChain(message.Text("请输入数字!(输入c结束会话)[", count, "]")) ctx.SendChain(message.Text("请输入数字!(输入c结束会话)[", count, "]"))
count-- count--
return itemNameFutureEvent(ctx, count) return itemNameFutureEvent(ctx, count)
} }
return num return num
} }
@ -461,7 +458,6 @@ func updateWM() {
// 获取Warframe市场的售价表并进行排序,cn_name为物品中文名称onlyMaxRank表示只取最高等级的物品返回物品售价表物品信息物品英文 // 获取Warframe市场的售价表并进行排序,cn_name为物品中文名称onlyMaxRank表示只取最高等级的物品返回物品售价表物品信息物品英文
func wmItemOrders(cnName string, onlyMaxRank bool) (orders, itemsInSet, string, error) { func wmItemOrders(cnName string, onlyMaxRank bool) (orders, itemsInSet, string, error) {
var wfapiio wfAPIItemsOrders var wfapiio wfAPIItemsOrders
data, err := web.RequestDataWithHeaders(&http.Client{}, fmt.Sprintf("https://api.warframe.market/v1/items/%s/orders?include=item", cnName), "GET", func(request *http.Request) error { data, err := web.RequestDataWithHeaders(&http.Client{}, fmt.Sprintf("https://api.warframe.market/v1/items/%s/orders?include=item", cnName), "GET", func(request *http.Request) error {
request.Header.Add("Accept", "application/json") request.Header.Add("Accept", "application/json")
@ -483,7 +479,6 @@ func wmItemOrders(cnName string, onlyMaxRank bool) (orders, itemsInSet, string,
} else if !onlyMaxRank { } else if !onlyMaxRank {
sellOrders = append(sellOrders, v) sellOrders = append(sellOrders, v)
} }
} }
} }
// 对报价表进行排序,由低到高 // 对报价表进行排序,由低到高