Skip to content

Commit

Permalink
update downloadto
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Dec 26, 2022
1 parent fa8428a commit d0610b1
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<h1>ZeroBot-Plugin</h1>

“椛椛是[真寻](https://github.com/HibiKier/zhenxun_bot)的朋友!”
“椛椛是[真寻](https://github.com/HibiKier/zhenxun_bot)的好朋友!”

ZeroBot-Plugin 是 ZeroBot 的 实用插件合集<br><br>

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ go 1.19
require (
github.com/Baidu-AIP/golang-sdk v1.1.1
github.com/Coloured-glaze/gg v1.3.4
github.com/FloatTech/AnimeAPI v1.6.1-0.20221225063958-b02234d50cc0
github.com/FloatTech/floatbox v0.0.0-20221210051813-4bd44af40c60
github.com/FloatTech/AnimeAPI v1.6.1-0.20221226052349-99c1398c6713
github.com/FloatTech/floatbox v0.0.0-20221223151526-b0b2b1101f78
github.com/FloatTech/sqlite v1.5.7
github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b
github.com/FloatTech/zbpctrl v1.5.3-0.20221210051848-740ab7bd6ec3
github.com/FloatTech/zbputils v1.6.1-0.20221212090658-d0de5338e354
github.com/FloatTech/zbputils v1.6.1-0.20221226052231-8e1c946d55c2
github.com/RomiChan/syncx v0.0.0-20221202055724-5f842c53020e
github.com/RomiChan/websocket v1.4.3-0.20220227141055-9b2c6168c9c5
github.com/antchfx/htmlquery v1.2.5
Expand Down
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/Coloured-glaze/gg v1.3.4 h1:l31zIF/HaVwkzjrj+A56RGQoSKyKuR1IWtIrqXGFStI=
github.com/Coloured-glaze/gg v1.3.4/go.mod h1:Ih5NLNNDHOy3RJbB0EPqGTreIzq/H02TGThIagh8HJg=
github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/FloatTech/AnimeAPI v1.6.1-0.20221225063958-b02234d50cc0 h1:0pzhpmqw13bf+QssdqfFx07vnwHETtEiJhCQIinbpSU=
github.com/FloatTech/AnimeAPI v1.6.1-0.20221225063958-b02234d50cc0/go.mod h1:Ri2Qa0552braxZVsk+axbBHL6UIWkGqQRETiIT9QTXI=
github.com/FloatTech/floatbox v0.0.0-20221210051813-4bd44af40c60 h1:S4KfcdK6LdOa0+TTyacHYOZ8aWkR6YbvlnI6GWe66Jc=
github.com/FloatTech/floatbox v0.0.0-20221210051813-4bd44af40c60/go.mod h1:/k2zxRJtAJ17w9fSpc7xf2QjPDTUBmqhBsOGyHVyX0U=
github.com/FloatTech/AnimeAPI v1.6.1-0.20221226052349-99c1398c6713 h1:jK94NVITfIcekb6HuK6UQbPT4b/S3XlfG//DT2ERbqk=
github.com/FloatTech/AnimeAPI v1.6.1-0.20221226052349-99c1398c6713/go.mod h1:8wsdxt90jVHX67xFqArQpqs5kVsxOds0Cps2MyHkZtQ=
github.com/FloatTech/floatbox v0.0.0-20221223151526-b0b2b1101f78 h1:5JovP9OGWxzWwglAjIUulD+EBcBwEHqpeagx9y5BKYA=
github.com/FloatTech/floatbox v0.0.0-20221223151526-b0b2b1101f78/go.mod h1:/k2zxRJtAJ17w9fSpc7xf2QjPDTUBmqhBsOGyHVyX0U=
github.com/FloatTech/rendercard v0.0.2-0.20221128165614-a41216d2422e h1:7bF01RHsYS99Zp+OWfob1W/Cymho6fcggoRSpiuiYB8=
github.com/FloatTech/rendercard v0.0.2-0.20221128165614-a41216d2422e/go.mod h1:e2M5OWspdblwq182zbVgRefiOc+gXtB1XzTW/2z86/I=
github.com/FloatTech/sqlite v1.5.7 h1:Bvo4LSojcZ6dVtbHrkqvt6z4v8e+sj0G5PSUIvdawsk=
Expand All @@ -16,8 +16,8 @@ github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b h1:tvciXWq2nuvTbFeJG
github.com/FloatTech/ttl v0.0.0-20220715042055-15612be72f5b/go.mod h1:fHZFWGquNXuHttu9dUYoKuNbm3dzLETnIOnm1muSfDs=
github.com/FloatTech/zbpctrl v1.5.3-0.20221210051848-740ab7bd6ec3 h1:dxARTVta2i48OOYa0xMRzWTO0lr6bM4M6JmQWLkHdNE=
github.com/FloatTech/zbpctrl v1.5.3-0.20221210051848-740ab7bd6ec3/go.mod h1:KFfMTzItP5usfnUYs7cFWjk89dzjtdO1eI+B1BVQNig=
github.com/FloatTech/zbputils v1.6.1-0.20221212090658-d0de5338e354 h1:vXchiNmu44lc7ECePl2ypreJhq8M7PDOdeP47hmmKqE=
github.com/FloatTech/zbputils v1.6.1-0.20221212090658-d0de5338e354/go.mod h1:S7M4oH9MM8DRmIOHfTcpUpIW9KbmWht9Y6zkZLtaeKE=
github.com/FloatTech/zbputils v1.6.1-0.20221226052231-8e1c946d55c2 h1:O2HW1nR4aMDGq3YdYhgSmcUPhY1O3T0wTsMdMzdEe2U=
github.com/FloatTech/zbputils v1.6.1-0.20221226052231-8e1c946d55c2/go.mod h1:xXUpFpXRV4M/dh5qM1DgOGFq/OMl3VF8yX2ue/dJv2Q=
github.com/PuerkitoBio/goquery v1.5.1/go.mod h1:GsLWisAFVj4WgDibEWF4pvYnkVQBpKBKeU+7zCJoLcc=
github.com/RomiChan/syncx v0.0.0-20221202055724-5f842c53020e h1:wR3MXQ3VbUlPKOOUwLOYgh/QaJThBTYtsl673O3lqSA=
github.com/RomiChan/syncx v0.0.0-20221202055724-5f842c53020e/go.mod h1:vD7Ra3Q9onRtojoY5sMCLQ7JBgjUsrXDnDKyFxqpf9w=
Expand Down
6 changes: 4 additions & 2 deletions plugin/aipaint/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"

"github.com/FloatTech/floatbox/file"
"github.com/FloatTech/floatbox/process"
)

type context struct {
Expand All @@ -27,13 +28,14 @@ func (cc *context) prepareLogos(s ...string) error {
for i, v := range s {
_, err := strconv.Atoi(v)
if err != nil {
err = file.DownloadTo("https://gchat.qpic.cn/gchatpic_new//--"+strings.ToUpper(v)+"/0", cc.usrdir+strconv.Itoa(i)+".gif", true)
err = file.DownloadTo("https://gchat.qpic.cn/gchatpic_new//--"+strings.ToUpper(v)+"/0", cc.usrdir+strconv.Itoa(i)+".gif")
} else {
err = file.DownloadTo("http://q4.qlogo.cn/g?b=qq&nk="+v+"&s=640", cc.usrdir+strconv.Itoa(i)+".gif", true)
err = file.DownloadTo("http://q4.qlogo.cn/g?b=qq&nk="+v+"&s=640", cc.usrdir+strconv.Itoa(i)+".gif")
}
if err != nil {
return err
}
process.SleepAbout1sTo2s()
}
return nil
}
6 changes: 4 additions & 2 deletions plugin/gif/logo.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,22 @@ import (
"strings"

"github.com/FloatTech/floatbox/file"
"github.com/FloatTech/floatbox/process"
"github.com/FloatTech/zbputils/img"
)

func (cc *context) prepareLogos(s ...string) error {
for i, v := range s {
_, err := strconv.Atoi(v)
if err != nil {
err = file.DownloadTo("https://gchat.qpic.cn/gchatpic_new//--"+strings.ToUpper(v)+"/0", cc.usrdir+strconv.Itoa(i)+".gif", true)
err = file.DownloadTo("https://gchat.qpic.cn/gchatpic_new//--"+strings.ToUpper(v)+"/0", cc.usrdir+strconv.Itoa(i)+".gif")
} else {
err = file.DownloadTo("http://q4.qlogo.cn/g?b=qq&nk="+v+"&s=640", cc.usrdir+strconv.Itoa(i)+".gif", true)
err = file.DownloadTo("http://q4.qlogo.cn/g?b=qq&nk="+v+"&s=640", cc.usrdir+strconv.Itoa(i)+".gif")
}
if err != nil {
return err
}
process.SleepAbout1sTo2s()
}
return nil
}
Expand Down
4 changes: 3 additions & 1 deletion plugin/guessmusic/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/Coloured-glaze/gg"
"github.com/FloatTech/floatbox/file"
"github.com/FloatTech/floatbox/img/writer"
"github.com/FloatTech/floatbox/process"
"github.com/FloatTech/zbputils/img/text"
)

Expand Down Expand Up @@ -380,8 +381,9 @@ func init() {
break
}
}
err = file.DownloadTo(fileURL, cfg.MusicPath+listName+"/"+fileSearchName, true)
err = file.DownloadTo(fileURL, cfg.MusicPath+listName+"/"+fileSearchName)
if err == nil {
process.SleepAbout1sTo2s()
ctx.SendChain(message.Text("成功!"))
} else {
ctx.SendChain(message.Text(serviceErr, err))
Expand Down
4 changes: 3 additions & 1 deletion plugin/nativewife/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/wdvxdr1123/ZeroBot/utils/helper"

"github.com/FloatTech/floatbox/file"
"github.com/FloatTech/floatbox/process"
ctrl "github.com/FloatTech/zbpctrl"
"github.com/FloatTech/zbputils/control"
)
Expand Down Expand Up @@ -78,8 +79,9 @@ func init() {
return
}
}
err := file.DownloadTo(url, grpfolder+"/"+name, true)
err := file.DownloadTo(url, grpfolder+"/"+name)
if err == nil {
process.SleepAbout1sTo2s()
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("成功!"))
} else {
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("错误:", err.Error()))
Expand Down
4 changes: 3 additions & 1 deletion plugin/score/sign_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/Coloured-glaze/gg"
"github.com/FloatTech/floatbox/file"
"github.com/FloatTech/floatbox/img/writer"
"github.com/FloatTech/floatbox/process"
ctrl "github.com/FloatTech/zbpctrl"
"github.com/FloatTech/zbputils/control"
"github.com/FloatTech/zbputils/ctxext"
Expand Down Expand Up @@ -305,5 +306,6 @@ func initPic(picFile string) error {
if file.IsExist(picFile) {
return nil
}
return file.DownloadTo(backgroundURL, picFile, true)
defer process.SleepAbout1sTo2s()
return file.DownloadTo(backgroundURL, picFile)
}

0 comments on commit d0610b1

Please sign in to comment.