Skip to content

Commit 3939e07

Browse files
committed
make lint happy
1 parent 16624a9 commit 3939e07

File tree

7 files changed

+29
-64
lines changed

7 files changed

+29
-64
lines changed

plugin_image_finder/keyword.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func init() {
7070
keyword := ctx.State["regex_matched"].([]string)[1]
7171
soutujson := soutuapi(keyword)
7272
pom1 := "https://i.pixiv.re"
73-
rannum := rintn(len(soutujson.Illusts))
73+
rannum := randintn(len(soutujson.Illusts))
7474
pom2 := soutujson.Illusts[rannum].ImageUrls.Medium[19:]
7575
ctx.SendChain(message.Image(pom1 + pom2))
7676
})
@@ -102,8 +102,8 @@ func soutuapi(keyword string) *resultjson {
102102
return result
103103
}
104104

105-
// rintn 从json里的30条数据中随机获取一条返回
106-
func rintn(len int) int {
105+
// randintn 从json里的30条数据中随机获取一条返回
106+
func randintn(n int) int {
107107
rand.Seed(time.Now().UnixNano())
108-
return rand.Intn(len)
108+
return rand.Intn(n)
109109
}

plugin_moyu/nowork.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func GetHoliday(name string) *Holiday {
4646
return h
4747
}
4848

49-
// 获取两个时间相差
49+
// String 获取两个时间相差
5050
func (h *Holiday) String() string {
5151
d := time.Until(h.date)
5252
switch {

plugin_omikuji/migrate/main.go

Lines changed: 0 additions & 46 deletions
This file was deleted.

plugin_shadiao/shadiao.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ import (
1010
)
1111

1212
const (
13-
chpURL = "https://chp.shadiao.app/api.php"
14-
duURL = "https://du.shadiao.app/api.php"
15-
pyqURL = "https://pyq.shadiao.app/api.php"
16-
yduanziURL = "http://www.yduanzi.com/duanzi/getduanzi"
17-
chayiURL = "https://api.lovelive.tools/api/SweetNothings/Web/0"
18-
ganhaiURL = "https://api.lovelive.tools/api/SweetNothings/Web/1"
19-
zuanURL = "https://zuanbot.com/api.php?level=min&lang=zh_cn"
13+
chpURL = "https://chp.shadiao.app/api.php"
14+
duURL = "https://du.shadiao.app/api.php"
15+
pyqURL = "https://pyq.shadiao.app/api.php"
16+
yduanziURL = "http://www.yduanzi.com/duanzi/getduanzi"
17+
chayiURL = "https://api.lovelive.tools/api/SweetNothings/Web/0"
18+
ganhaiURL = "https://api.lovelive.tools/api/SweetNothings/Web/1"
19+
// zuanURL = "https://zuanbot.com/api.php?level=min&lang=zh_cn"
2020
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"
2121
chpReferer = "https://chp.shadiao.app/"
2222
duReferer = "https://du.shadiao.app/"
2323
pyqReferer = "https://pyq.shadiao.app/"
2424
yduanziReferer = "http://www.yduanzi.com/?utm_source=shadiao.app"
2525
loveliveReferer = "https://lovelive.tools/"
26-
zuanReferer = "https://zuanbot.com/"
27-
prio = 10
26+
// zuanReferer = "https://zuanbot.com/"
27+
prio = 10
2828
)
2929

3030
var (

plugin_sleep_manage/model/model.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ func Open(dbpath string) (*SleepDB, error) {
3737
db, err := gorm.Open("sqlite3", dbpath)
3838
if err != nil {
3939
return nil, err
40-
} else {
41-
return (*SleepDB)(db), nil
4240
}
41+
return (*SleepDB)(db), nil
4342
}
4443

4544
// Close 关闭

plugin_vtb_quotation/model/model.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ import (
1010
"time"
1111

1212
"github.com/jinzhu/gorm"
13-
_ "github.com/logoove/sqlite"
13+
_ "github.com/logoove/sqlite" // import sql
1414
"github.com/sirupsen/logrus"
1515
"github.com/tidwall/gjson"
1616
)
1717

18+
// VtbDB vtb 数据库
1819
type VtbDB gorm.DB
1920

21+
// Initialize ...
2022
func Initialize(dbpath string) *VtbDB {
2123
var err error
2224
if _, err = os.Stat(dbpath); err != nil || os.IsNotExist(err) {
@@ -35,6 +37,7 @@ func Initialize(dbpath string) *VtbDB {
3537
return (*VtbDB)(gdb)
3638
}
3739

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

60+
// TableName ...
5761
func (FirstCategory) TableName() string {
5862
return "first_category"
5963
}
@@ -68,6 +72,7 @@ type SecondCategory struct {
6872
SecondCategoryDescription string `gorm:"column:second_category_description"`
6973
}
7074

75+
// TableName ...
7176
func (SecondCategory) TableName() string {
7277
return "second_category"
7378
}
@@ -84,6 +89,7 @@ type ThirdCategory struct {
8489
ThirdCategoryDescription string `gorm:"column:third_category_description"`
8590
}
8691

92+
// TableName ...
8793
func (ThirdCategory) TableName() string {
8894
return "third_category"
8995
}
@@ -163,7 +169,7 @@ func (vdb *VtbDB) GetAllThirdCategoryMessageByFirstIndexAndSecondIndex(firstInde
163169
return ThirdStepMessage
164170
}
165171

166-
// GetThirdCategory
172+
// GetThirdCategory ...
167173
func (vdb *VtbDB) GetThirdCategory(firstIndex, secondIndex, thirdIndex int) ThirdCategory {
168174
db := (*gorm.DB)(vdb)
169175
var fc FirstCategory
@@ -173,6 +179,7 @@ func (vdb *VtbDB) GetThirdCategory(firstIndex, secondIndex, thirdIndex int) Thir
173179
return tc
174180
}
175181

182+
// RandomVtb ...
176183
func (vdb *VtbDB) RandomVtb() ThirdCategory {
177184
db := (*gorm.DB)(vdb)
178185
rand.Seed(time.Now().UnixNano())
@@ -185,6 +192,7 @@ func (vdb *VtbDB) RandomVtb() ThirdCategory {
185192
return tc
186193
}
187194

195+
// GetFirstCategoryByFirstUid ...
188196
func (vdb *VtbDB) GetFirstCategoryByFirstUid(firstUid string) FirstCategory {
189197
db := (*gorm.DB)(vdb)
190198
var fc FirstCategory
@@ -193,13 +201,15 @@ func (vdb *VtbDB) GetFirstCategoryByFirstUid(firstUid string) FirstCategory {
193201
return fc
194202
}
195203

204+
// Close ...
196205
func (vdb *VtbDB) Close() error {
197206
db := (*gorm.DB)(vdb)
198207
return db.Close()
199208
}
200209

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

212+
// GetVtbList ...
203213
func (vdb *VtbDB) GetVtbList() (uidList []string) {
204214
db := (*gorm.DB)(vdb)
205215
client := &http.Client{}
@@ -261,6 +271,7 @@ func (vdb *VtbDB) GetVtbList() (uidList []string) {
261271
return uidList
262272
}
263273

274+
// StoreVtb ...
264275
func (vdb *VtbDB) StoreVtb(uid string) {
265276
db := (*gorm.DB)(vdb)
266277
vtbUrl := "https://vtbkeyboard.moe/api/get_vtb_page?uid=" + uid

utils/math/conv.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package math
22

33
import "strconv"
44

5+
// Str2Int64 string to int64
56
func Str2Int64(str string) int64 {
67
val, _ := strconv.ParseInt(str, 10, 64)
78
return val

0 commit comments

Comments
 (0)