✏️ make lint happy

This commit is contained in:
fumiama 2021-12-19 16:04:14 +08:00
parent 4ad7ff7971
commit 5ff9069ff2
13 changed files with 26 additions and 21 deletions

View File

@ -23,7 +23,7 @@ const (
)
var (
datapath = file.BOT_PATH + "/data/acgimage/"
datapath = file.BOTPATH + "/data/acgimage/"
cacheuri = "file:///" + datapath + "cache"
// r18有一定保护一般不会发出图片
randapi = "&loli=true&r18=true"

View File

@ -1,4 +1,5 @@
package plugin_coser
// Package coser images
package coser
import (
"time"

View File

@ -18,7 +18,7 @@ import (
)
var (
cachedir = file.BOT_PATH + "/data/hs/"
cachedir = file.BOTPATH + "/data/hs/"
reqconf = [...]string{"GET", "https://hs.fbigame.com",
"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Mobile Safari/537.36"}
)

View File

@ -22,7 +22,7 @@ import (
const base = "data/nwife"
var baseuri = "file:///" + file.BOT_PATH + "/" + base
var baseuri = "file:///" + file.BOTPATH + "/" + base
func init() {
err := os.MkdirAll(base, 0755)

View File

@ -97,15 +97,17 @@ type dataQYK struct {
Content string `json:"content"`
}
const (
qykURL = "http://api.qingyunke.com/api.php"
key = "free"
appid = "0"
)
// 青云客取消息
func getMessage(msg string) (string, error) {
qykUrl := "http://api.qingyunke.com/api.php"
key := "free"
appid := "0"
qykUrl = fmt.Sprintf(qykUrl+"?key=%s&appid=%s&msg=%s", key, appid, url.QueryEscape(msg))
u := fmt.Sprintf(qykURL+"?key=%s&appid=%s&msg=%s", key, appid, url.QueryEscape(msg))
client := &http.Client{}
req, err := http.NewRequest("GET", qykUrl, nil)
req, err := http.NewRequest("GET", u, nil)
if err != nil {
return "", err
}

View File

@ -19,7 +19,7 @@ import (
)
var (
datapath = file.BOT_PATH + "/data/saucenao/"
datapath = file.BOTPATH + "/data/saucenao/"
)
func init() { // 插件主体

View File

@ -217,7 +217,7 @@ func (p *imgpool) pop(imgtype string) (illust *pixiv.Illust) {
func file(i *pixiv.Illust) string {
filename := fmt.Sprint(i.Pid)
filepath := fileutil.BOT_PATH + `/` + pool.Path + filename
filepath := fileutil.BOTPATH + `/` + pool.Path + filename
if _, err := os.Stat(filepath + ".jpg"); err == nil || os.IsExist(err) {
return `file:///` + filepath + ".jpg"
}

View File

@ -1,4 +1,4 @@
package plugin_sleep_manage
package sleepmanage
import (
"os"
@ -12,11 +12,10 @@ import (
func init() {
go func() {
defer func() {
//recover() //可以打印panic的错误信息
if err := recover(); err != nil { //产生了panic异常
if err := recover(); err != nil {
log.Println(err)
}
}() //别忘了(), 调用此匿名函数
}()
process.SleepAbout1sTo2s()
_ = os.MkdirAll(dbpath, 0755)
model.Initialize(dbfile)

View File

@ -1,3 +1,4 @@
// Package model 睡眠管理数据库
package model
import (

View File

@ -1,4 +1,5 @@
package plugin_sleep_manage
// Package sleepmanage 睡眠管理
package sleepmanage
import (
"fmt"

View File

@ -2,8 +2,8 @@ package file
import "os"
// BOT_PATH BOT当前路径
var BOT_PATH = Pwd()
// BOTPATH BOT当前路径
var BOTPATH = Pwd()
// IsExist 文件/路径存在
func IsExist(path string) bool {

View File

@ -1,3 +1,4 @@
// Package rule zb 规则扩展
package rule
import zero "github.com/wdvxdr1123/ZeroBot"

View File

@ -366,10 +366,10 @@ func (db *Sqlite) Count(table string) (num int, err error) {
return num, rows.Err()
}
if rows.Next() {
rows.Scan(&num)
err = rows.Scan(&num)
}
rows.Close()
return num, nil
return num, err
}
// tags 反射 返回结构体对象的 tag 数组