Skip to content

Commit

Permalink
make lint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Dec 26, 2021
1 parent 16624a9 commit 3939e07
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 64 deletions.
8 changes: 4 additions & 4 deletions plugin_image_finder/keyword.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func init() {
keyword := ctx.State["regex_matched"].([]string)[1]
soutujson := soutuapi(keyword)
pom1 := "https://i.pixiv.re"
rannum := rintn(len(soutujson.Illusts))
rannum := randintn(len(soutujson.Illusts))
pom2 := soutujson.Illusts[rannum].ImageUrls.Medium[19:]
ctx.SendChain(message.Image(pom1 + pom2))
})
Expand Down Expand Up @@ -102,8 +102,8 @@ func soutuapi(keyword string) *resultjson {
return result
}

// rintn 从json里的30条数据中随机获取一条返回
func rintn(len int) int {
// randintn 从json里的30条数据中随机获取一条返回
func randintn(n int) int {
rand.Seed(time.Now().UnixNano())
return rand.Intn(len)
return rand.Intn(n)
}
2 changes: 1 addition & 1 deletion plugin_moyu/nowork.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func GetHoliday(name string) *Holiday {
return h
}

// 获取两个时间相差
// String 获取两个时间相差
func (h *Holiday) String() string {
d := time.Until(h.date)
switch {
Expand Down
46 changes: 0 additions & 46 deletions plugin_omikuji/migrate/main.go

This file was deleted.

18 changes: 9 additions & 9 deletions plugin_shadiao/shadiao.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ import (
)

const (
chpURL = "https://chp.shadiao.app/api.php"
duURL = "https://du.shadiao.app/api.php"
pyqURL = "https://pyq.shadiao.app/api.php"
yduanziURL = "http://www.yduanzi.com/duanzi/getduanzi"
chayiURL = "https://api.lovelive.tools/api/SweetNothings/Web/0"
ganhaiURL = "https://api.lovelive.tools/api/SweetNothings/Web/1"
zuanURL = "https://zuanbot.com/api.php?level=min&lang=zh_cn"
chpURL = "https://chp.shadiao.app/api.php"
duURL = "https://du.shadiao.app/api.php"
pyqURL = "https://pyq.shadiao.app/api.php"
yduanziURL = "http://www.yduanzi.com/duanzi/getduanzi"
chayiURL = "https://api.lovelive.tools/api/SweetNothings/Web/0"
ganhaiURL = "https://api.lovelive.tools/api/SweetNothings/Web/1"
// zuanURL = "https://zuanbot.com/api.php?level=min&lang=zh_cn"
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
chpReferer = "https://chp.shadiao.app/"
duReferer = "https://du.shadiao.app/"
pyqReferer = "https://pyq.shadiao.app/"
yduanziReferer = "http://www.yduanzi.com/?utm_source=shadiao.app"
loveliveReferer = "https://lovelive.tools/"
zuanReferer = "https://zuanbot.com/"
prio = 10
// zuanReferer = "https://zuanbot.com/"
prio = 10
)

var (
Expand Down
3 changes: 1 addition & 2 deletions plugin_sleep_manage/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ func Open(dbpath string) (*SleepDB, error) {
db, err := gorm.Open("sqlite3", dbpath)
if err != nil {
return nil, err
} else {
return (*SleepDB)(db), nil
}
return (*SleepDB)(db), nil
}

// Close 关闭
Expand Down
15 changes: 13 additions & 2 deletions plugin_vtb_quotation/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ import (
"time"

"github.com/jinzhu/gorm"
_ "github.com/logoove/sqlite"
_ "github.com/logoove/sqlite" // import sql
"github.com/sirupsen/logrus"
"github.com/tidwall/gjson"
)

// VtbDB vtb 数据库
type VtbDB gorm.DB

// Initialize ...
func Initialize(dbpath string) *VtbDB {
var err error
if _, err = os.Stat(dbpath); err != nil || os.IsNotExist(err) {
Expand All @@ -35,6 +37,7 @@ func Initialize(dbpath string) *VtbDB {
return (*VtbDB)(gdb)
}

// Open ...
func Open(dbpath string) (*VtbDB, error) {
db, err := gorm.Open("sqlite3", dbpath)
if err != nil {
Expand All @@ -54,6 +57,7 @@ type FirstCategory struct {
FirstCategoryIconPath string `gorm:"column:first_category_icon_path"`
}

// TableName ...
func (FirstCategory) TableName() string {
return "first_category"
}
Expand All @@ -68,6 +72,7 @@ type SecondCategory struct {
SecondCategoryDescription string `gorm:"column:second_category_description"`
}

// TableName ...
func (SecondCategory) TableName() string {
return "second_category"
}
Expand All @@ -84,6 +89,7 @@ type ThirdCategory struct {
ThirdCategoryDescription string `gorm:"column:third_category_description"`
}

// TableName ...
func (ThirdCategory) TableName() string {
return "third_category"
}
Expand Down Expand Up @@ -163,7 +169,7 @@ func (vdb *VtbDB) GetAllThirdCategoryMessageByFirstIndexAndSecondIndex(firstInde
return ThirdStepMessage
}

// GetThirdCategory
// GetThirdCategory ...
func (vdb *VtbDB) GetThirdCategory(firstIndex, secondIndex, thirdIndex int) ThirdCategory {
db := (*gorm.DB)(vdb)
var fc FirstCategory
Expand All @@ -173,6 +179,7 @@ func (vdb *VtbDB) GetThirdCategory(firstIndex, secondIndex, thirdIndex int) Thir
return tc
}

// RandomVtb ...
func (vdb *VtbDB) RandomVtb() ThirdCategory {
db := (*gorm.DB)(vdb)
rand.Seed(time.Now().UnixNano())
Expand All @@ -185,6 +192,7 @@ func (vdb *VtbDB) RandomVtb() ThirdCategory {
return tc
}

// GetFirstCategoryByFirstUid ...
func (vdb *VtbDB) GetFirstCategoryByFirstUid(firstUid string) FirstCategory {
db := (*gorm.DB)(vdb)
var fc FirstCategory
Expand All @@ -193,13 +201,15 @@ func (vdb *VtbDB) GetFirstCategoryByFirstUid(firstUid string) FirstCategory {
return fc
}

// Close ...
func (vdb *VtbDB) Close() error {
db := (*gorm.DB)(vdb)
return db.Close()
}

const vtbUrl = "https://vtbkeyboard.moe/api/get_vtb_list"

// GetVtbList ...
func (vdb *VtbDB) GetVtbList() (uidList []string) {
db := (*gorm.DB)(vdb)
client := &http.Client{}
Expand Down Expand Up @@ -261,6 +271,7 @@ func (vdb *VtbDB) GetVtbList() (uidList []string) {
return uidList
}

// StoreVtb ...
func (vdb *VtbDB) StoreVtb(uid string) {
db := (*gorm.DB)(vdb)
vtbUrl := "https://vtbkeyboard.moe/api/get_vtb_page?uid=" + uid
Expand Down
1 change: 1 addition & 0 deletions utils/math/conv.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package math

import "strconv"

// Str2Int64 string to int64
func Str2Int64(str string) int64 {
val, _ := strconv.ParseInt(str, 10, 64)
return val
Expand Down

0 comments on commit 3939e07

Please sign in to comment.