Skip to content
This repository was archived by the owner on Jan 31, 2023. It is now read-only.

Commit 70ecc87

Browse files
committed
Add blacklist-fanart feature
1 parent 5b89ba8 commit 70ecc87

5 files changed

Lines changed: 43 additions & 13 deletions

File tree

config.toml.template

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ DonationLink = "#DonationLink"
77
Domain = "humanz.tech"
88
LowResources = true
99

10+
[BannFanartAccount]
11+
Twitter = ["VtuberAnlysBot"]
12+
1013
YoutubeToken = [
1114
"#GoogleAPI",
1215
"#GoogleAPI"

pkg/config/config.go

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -151,19 +151,24 @@ const (
151151

152152
//ConfigFile config file struct for config.toml
153153
type ConfigFile struct {
154-
Discord string `toml:"Discord"`
155-
BiliSess string `toml:"BiliSess"`
156-
PixivSession string `toml:"PixivSess"`
157-
SauceAPI string `toml:"SauceAPI"`
158-
InviteLog string `toml:"InviteLog"`
159-
PilotReporting string `toml:"PilotReporting"`
160-
MultiTOR string `toml:"Multitor"`
161-
DonationLink string `toml:"DonationLink"`
162-
TopGG string `toml:"TOPGG"`
163-
Domain string `toml:"Domain"`
164-
PrometheusURL string `toml:"PrometheusURL"`
165-
Metric bool `toml:"Metric"`
166-
Twitch struct {
154+
Discord string `toml:"Discord"`
155+
BiliSess string `toml:"BiliSess"`
156+
PixivSession string `toml:"PixivSess"`
157+
SauceAPI string `toml:"SauceAPI"`
158+
InviteLog string `toml:"InviteLog"`
159+
PilotReporting string `toml:"PilotReporting"`
160+
MultiTOR string `toml:"Multitor"`
161+
DonationLink string `toml:"DonationLink"`
162+
TopGG string `toml:"TOPGG"`
163+
Domain string `toml:"Domain"`
164+
PrometheusURL string `toml:"PrometheusURL"`
165+
Metric bool `toml:"Metric"`
166+
BannFanartAccount struct {
167+
Twitter []string `toml:"Twitter"`
168+
BiliBili []string `toml:"BiliBili"`
169+
Pixiv []string `toml:"Pixiv"`
170+
} `toml:"BannFanartAccount"`
171+
Twitch struct {
167172
ClientID string `toml:"ClientID"`
168173
ClientSecret string `toml:"ClientSecret"`
169174
} `toml:"Twitch"`

pkg/database/fanart.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,12 @@ func (Member Member) ScrapTwitterFanart(Scraper *twitterscraper.Scraper, Lewd bo
555555
continue
556556
}
557557

558+
for _, Ban := range config.GoSimpConf.BannFanartAccount.Twitter {
559+
if strings.EqualFold(Ban, tweet.Username) {
560+
continue
561+
}
562+
}
563+
558564
for _, TweetHashtag := range tweet.Hashtags {
559565
if (strings.EqualFold("#"+TweetHashtag, Member.TwitterHashtag) || strings.EqualFold("#"+TweetHashtag, Member.TwitterLewd)) && !tweet.IsQuoted && !tweet.IsReply && len(tweet.Photos) > 0 {
560566
TweetArt := DataFanart{
@@ -590,6 +596,8 @@ func (Member Member) ScrapTwitterFanart(Scraper *twitterscraper.Scraper, Lewd bo
590596
if New {
591597
FanartList = append(FanartList, TweetArt)
592598
}
599+
600+
break
593601
}
594602
}
595603
}

service/fanart/bilibili/bilibili.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"flag"
77
"net/url"
8+
"strings"
89
"sync"
910
"time"
1011

@@ -216,6 +217,13 @@ func (k *checkBlJob) Run() {
216217
"Vtuber": Member.Name,
217218
}).Error(err)
218219
}
220+
221+
for _, Ban := range config.GoSimpConf.BannFanartAccount.BiliBili {
222+
if strings.EqualFold(Ban, v.Desc.UserProfile.Info.Uname) {
223+
continue
224+
}
225+
}
226+
219227
if STB.Item.Pictures != nil && v.Desc.Type == 2 { //type 2 is picture post (prob,heheheh)
220228
for _, pic := range STB.Item.Pictures {
221229
img = append(img, pic.ImgSrc)

service/fanart/pixiv/pixiv.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,12 @@ func Pixiv(p string, FixFanArt *database.DataFanart, l bool) error {
212212
TextFix string
213213
)
214214

215+
for _, Ban := range config.GoSimpConf.BannFanartAccount.Pixiv {
216+
if strings.EqualFold(Ban, v2["userName"].(string)) {
217+
continue
218+
}
219+
}
220+
215221
if IsVtuber {
216222
if v2["xRestrict"].(float64) == 0 && !l {
217223
illusbyte, err := network.Curl(config.PixivIllustsEnd+v2["id"].(string), nil)

0 commit comments

Comments
 (0)