修改lsp图片大小

This commit is contained in:
liyp 2024-04-23 21:32:59 +08:00
parent ffab2cb534
commit 46dde0cd18
2 changed files with 6 additions and 5 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
data.db data.db
test.json test.json
config.toml config.toml
*.exe

View file

@ -15,7 +15,7 @@ type Lsp struct {
func (a *Lsp) GetMsg() string { func (a *Lsp) GetMsg() string {
a.AllowGroup = []string{"313047773"} a.AllowGroup = []string{"313047773"}
url := "https://api.lolicon.app/setu/v2?size=mini&r18=0" url := "https://api.lolicon.app/setu/v2?r18=0&size=small"
resp, err := http.Get(url) resp, err := http.Get(url)
if err != nil { if err != nil {
return "获取失败" return "获取失败"
@ -34,11 +34,11 @@ func (a *Lsp) GetMsg() string {
data := res["data"].([]interface{}) data := res["data"].([]interface{})
uid := data[0].(map[string]interface{})["uid"].(float64) uid := data[0].(map[string]interface{})["uid"].(float64)
urls := data[0].(map[string]interface{})["urls"].(map[string]interface{}) urls := data[0].(map[string]interface{})["urls"].(map[string]interface{})
imgUrl := urls["mini"].(string) imgUrl := urls["small"].(string)
// title := data[0].(map[string]interface{})["title"].(string) // title := data[0].(map[string]interface{})["title"].(string)
// println("标题:" + title + "\n" + imgUrl) // println("标题:" + title + "\n" + imgUrl)
msg := fmt.Sprintf("[CQ:reply,id=%s]Pixiv ID:%f", a.MID, uid) msg := fmt.Sprintf("[CQ:reply,id=%s]Pixiv ID:%d", a.MID, int64(uid))
a.SendMsg(msg) a.SendMsg(msg)
return fmt.Sprintf("[CQ:image,file=%s,type=flash]", imgUrl) return fmt.Sprintf("[CQ:image,file=%s]", imgUrl)
} }