Skip to content

Commit c4c3f79

Browse files
committed
💩👌 make lint happy
1 parent 9cb54a3 commit c4c3f79

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

plugin/bilibili/card2msg.go

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

1212
var (
13-
MsgType = map[int]string{
13+
msgType = map[int]string{
1414
1: "转发了动态",
1515
2: "有图营业",
1616
4: "无图营业",
@@ -47,7 +47,7 @@ func dynamicCard2msg(dynamicCard *bz.DynamicCard) (msg []message.MessageSegment,
4747
// 生成消息
4848
switch cType {
4949
case 1:
50-
msg = append(msg, message.Text(card.User.Uname, MsgType[cType], "\n",
50+
msg = append(msg, message.Text(card.User.Uname, msgType[cType], "\n",
5151
card.Item.Content, "\n",
5252
"转发的内容: \n"))
5353
var originMsg []message.MessageSegment
@@ -62,13 +62,13 @@ func dynamicCard2msg(dynamicCard *bz.DynamicCard) (msg []message.MessageSegment,
6262
}
6363
msg = append(msg, originMsg...)
6464
case 2:
65-
msg = append(msg, message.Text(card.User.Name, "在", time.Unix(int64(card.Item.UploadTime), 0).Format("2006-01-02 15:04:05"), MsgType[cType], "\n",
65+
msg = append(msg, message.Text(card.User.Name, "在", time.Unix(int64(card.Item.UploadTime), 0).Format("2006-01-02 15:04:05"), msgType[cType], "\n",
6666
card.Item.Description))
6767
for i := 0; i < len(card.Item.Pictures); i++ {
6868
msg = append(msg, message.Image(card.Item.Pictures[i].ImgSrc))
6969
}
7070
case 4:
71-
msg = append(msg, message.Text(card.User.Uname, "在", time.Unix(int64(card.Item.Timestamp), 0).Format("2006-01-02 15:04:05"), MsgType[cType], "\n",
71+
msg = append(msg, message.Text(card.User.Uname, "在", time.Unix(int64(card.Item.Timestamp), 0).Format("2006-01-02 15:04:05"), msgType[cType], "\n",
7272
card.Item.Content, "\n"))
7373
if dynamicCard.Extension.Vote != "" {
7474
msg = append(msg, message.Text("【投票】", vote.Desc, "\n",
@@ -83,18 +83,18 @@ func dynamicCard2msg(dynamicCard *bz.DynamicCard) (msg []message.MessageSegment,
8383
}
8484
}
8585
case 8:
86-
msg = append(msg, message.Text(card.Owner.Name, "在", time.Unix(int64(card.Pubdate), 0).Format("2006-01-02 15:04:05"), MsgType[cType], "\n",
86+
msg = append(msg, message.Text(card.Owner.Name, "在", time.Unix(int64(card.Pubdate), 0).Format("2006-01-02 15:04:05"), msgType[cType], "\n",
8787
card.Title))
8888
msg = append(msg, message.Image(card.Pic))
8989
msg = append(msg, message.Text(card.Desc, "\n",
9090
card.ShareSubtitle, "\n",
9191
"视频链接: ", card.ShortLink, "\n"))
9292
case 16:
93-
msg = append(msg, message.Text(card.User.Name, "在", time.Unix(int64(card.Item.UploadTime), 0).Format("2006-01-02 15:04:05"), MsgType[cType], "\n",
93+
msg = append(msg, message.Text(card.User.Name, "在", time.Unix(int64(card.Item.UploadTime), 0).Format("2006-01-02 15:04:05"), msgType[cType], "\n",
9494
card.Item.Description))
9595
msg = append(msg, message.Image(card.Item.Cover.Default))
9696
case 64:
97-
msg = append(msg, message.Text(card.Author.(map[string]any)["name"], "在", time.Unix(int64(card.PublishTime), 0).Format("2006-01-02 15:04:05"), MsgType[cType], "\n",
97+
msg = append(msg, message.Text(card.Author.(map[string]any)["name"], "在", time.Unix(int64(card.PublishTime), 0).Format("2006-01-02 15:04:05"), msgType[cType], "\n",
9898
card.Title, "\n",
9999
card.Summary))
100100
for i := 0; i < len(card.ImageUrls); i++ {
@@ -104,7 +104,7 @@ func dynamicCard2msg(dynamicCard *bz.DynamicCard) (msg []message.MessageSegment,
104104
msg = append(msg, message.Text("文章链接: https://www.bilibili.com/read/cv", card.ID, "\n"))
105105
}
106106
case 256:
107-
msg = append(msg, message.Text(card.Upper, "在", time.Unix(int64(card.Ctime), 0).Format("2006-01-02 15:04:05"), MsgType[cType], "\n",
107+
msg = append(msg, message.Text(card.Upper, "在", time.Unix(int64(card.Ctime), 0).Format("2006-01-02 15:04:05"), msgType[cType], "\n",
108108
card.Title))
109109
msg = append(msg, message.Image(card.Cover))
110110
msg = append(msg, message.Text(card.Intro, "\n"))
@@ -113,15 +113,15 @@ func dynamicCard2msg(dynamicCard *bz.DynamicCard) (msg []message.MessageSegment,
113113
}
114114

115115
case 2048:
116-
msg = append(msg, message.Text(card.User.Uname, MsgType[cType], "\n",
116+
msg = append(msg, message.Text(card.User.Uname, msgType[cType], "\n",
117117
card.Vest.Content, "\n",
118118
card.Sketch.Title, "\n",
119119
card.Sketch.DescText, "\n"))
120120
msg = append(msg, message.Image(card.Sketch.CoverURL))
121121
msg = append(msg, message.Text("分享链接: ", card.Sketch.TargetURL, "\n"))
122122
case 4308:
123123
if dynamicCard.Desc.UserProfile.Info.Uname != "" {
124-
msg = append(msg, message.Text(dynamicCard.Desc.UserProfile.Info.Uname, MsgType[cType], "\n"))
124+
msg = append(msg, message.Text(dynamicCard.Desc.UserProfile.Info.Uname, msgType[cType], "\n"))
125125
}
126126
msg = append(msg, message.Image(card.LivePlayInfo.Cover))
127127
msg = append(msg, message.Text("\n", card.LivePlayInfo.Title, "\n",
@@ -154,7 +154,7 @@ func card2msg(dynamicCard *bz.DynamicCard, card *bz.Card, cType int) (msg []mess
154154
// 生成消息
155155
switch cType {
156156
case 1:
157-
msg = append(msg, message.Text(card.User.Uname, MsgType[cType], "\n",
157+
msg = append(msg, message.Text(card.User.Uname, msgType[cType], "\n",
158158
card.Item.Content, "\n",
159159
"转发的内容: \n"))
160160
var originMsg []message.MessageSegment
@@ -169,13 +169,13 @@ func card2msg(dynamicCard *bz.DynamicCard, card *bz.Card, cType int) (msg []mess
169169
}
170170
msg = append(msg, originMsg...)
171171
case 2:
172-
msg = append(msg, message.Text(card.User.Name, "在", time.Unix(int64(card.Item.UploadTime), 0).Format("2006-01-02 15:04:05"), MsgType[cType], "\n",
172+
msg = append(msg, message.Text(card.User.Name, "在", time.Unix(int64(card.Item.UploadTime), 0).Format("2006-01-02 15:04:05"), msgType[cType], "\n",
173173
card.Item.Description))
174174
for i := 0; i < len(card.Item.Pictures); i++ {
175175
msg = append(msg, message.Image(card.Item.Pictures[i].ImgSrc))
176176
}
177177
case 4:
178-
msg = append(msg, message.Text(card.User.Uname, "在", time.Unix(int64(card.Item.Timestamp), 0).Format("2006-01-02 15:04:05"), MsgType[cType], "\n",
178+
msg = append(msg, message.Text(card.User.Uname, "在", time.Unix(int64(card.Item.Timestamp), 0).Format("2006-01-02 15:04:05"), msgType[cType], "\n",
179179
card.Item.Content, "\n"))
180180
if dynamicCard.Extension.Vote != "" {
181181
msg = append(msg, message.Text("【投票】", vote.Desc, "\n",
@@ -190,18 +190,18 @@ func card2msg(dynamicCard *bz.DynamicCard, card *bz.Card, cType int) (msg []mess
190190
}
191191
}
192192
case 8:
193-
msg = append(msg, message.Text(card.Owner.Name, "在", time.Unix(int64(card.Pubdate), 0).Format("2006-01-02 15:04:05"), MsgType[cType], "\n",
193+
msg = append(msg, message.Text(card.Owner.Name, "在", time.Unix(int64(card.Pubdate), 0).Format("2006-01-02 15:04:05"), msgType[cType], "\n",
194194
card.Title))
195195
msg = append(msg, message.Image(card.Pic))
196196
msg = append(msg, message.Text(card.Desc, "\n",
197197
card.ShareSubtitle, "\n",
198198
"视频链接: ", card.ShortLink, "\n"))
199199
case 16:
200-
msg = append(msg, message.Text(card.User.Name, "在", time.Unix(int64(card.Item.UploadTime), 0).Format("2006-01-02 15:04:05"), MsgType[cType], "\n",
200+
msg = append(msg, message.Text(card.User.Name, "在", time.Unix(int64(card.Item.UploadTime), 0).Format("2006-01-02 15:04:05"), msgType[cType], "\n",
201201
card.Item.Description))
202202
msg = append(msg, message.Image(card.Item.Cover.Default))
203203
case 64:
204-
msg = append(msg, message.Text(card.Author.(map[string]any)["name"], "在", time.Unix(int64(card.PublishTime), 0).Format("2006-01-02 15:04:05"), MsgType[cType], "\n",
204+
msg = append(msg, message.Text(card.Author.(map[string]any)["name"], "在", time.Unix(int64(card.PublishTime), 0).Format("2006-01-02 15:04:05"), msgType[cType], "\n",
205205
card.Title, "\n",
206206
card.Summary))
207207
for i := 0; i < len(card.ImageUrls); i++ {
@@ -211,7 +211,7 @@ func card2msg(dynamicCard *bz.DynamicCard, card *bz.Card, cType int) (msg []mess
211211
msg = append(msg, message.Text("文章链接: https://www.bilibili.com/read/cv", card.ID, "\n"))
212212
}
213213
case 256:
214-
msg = append(msg, message.Text(card.Upper, "在", time.Unix(int64(card.Ctime), 0).Format("2006-01-02 15:04:05"), MsgType[cType], "\n",
214+
msg = append(msg, message.Text(card.Upper, "在", time.Unix(int64(card.Ctime), 0).Format("2006-01-02 15:04:05"), msgType[cType], "\n",
215215
card.Title))
216216
msg = append(msg, message.Image(card.Cover))
217217
msg = append(msg, message.Text(card.Intro, "\n"))
@@ -220,15 +220,15 @@ func card2msg(dynamicCard *bz.DynamicCard, card *bz.Card, cType int) (msg []mess
220220
}
221221

222222
case 2048:
223-
msg = append(msg, message.Text(card.User.Uname, MsgType[cType], "\n",
223+
msg = append(msg, message.Text(card.User.Uname, msgType[cType], "\n",
224224
card.Vest.Content, "\n",
225225
card.Sketch.Title, "\n",
226226
card.Sketch.DescText, "\n"))
227227
msg = append(msg, message.Image(card.Sketch.CoverURL))
228228
msg = append(msg, message.Text("分享链接: ", card.Sketch.TargetURL, "\n"))
229229
case 4308:
230230
if dynamicCard.Desc.UserProfile.Info.Uname != "" {
231-
msg = append(msg, message.Text(dynamicCard.Desc.UserProfile.Info.Uname, MsgType[cType], "\n"))
231+
msg = append(msg, message.Text(dynamicCard.Desc.UserProfile.Info.Uname, msgType[cType], "\n"))
232232
}
233233
msg = append(msg, message.Image(card.LivePlayInfo.Cover))
234234
msg = append(msg, message.Text("\n", card.LivePlayInfo.Title, "\n",

0 commit comments

Comments
 (0)