mirror of
https://github.com/lyx0/nourybot.git
synced 2024-11-13 19:49:55 +01:00
fix: fixed app restart after uploading file from ()dl usage
This commit is contained in:
parent
5363eb45cc
commit
68f5cbbb9e
|
@ -118,11 +118,6 @@ func main() {
|
|||
"err", err,
|
||||
)
|
||||
}
|
||||
|
||||
sugar.Infow("db.Stats",
|
||||
"db.Stats", db.Stats(),
|
||||
)
|
||||
|
||||
app := &application{
|
||||
TwitchClient: tc,
|
||||
HelixClient: helixClient,
|
||||
|
@ -132,6 +127,10 @@ func main() {
|
|||
Scheduler: cron.New(),
|
||||
}
|
||||
|
||||
app.Log.Infow("db.Stats",
|
||||
"db.Stats", db.Stats(),
|
||||
)
|
||||
|
||||
// Received a PrivateMessage (normal chat message).
|
||||
app.TwitchClient.OnPrivateMessage(func(message twitch.PrivateMessage) {
|
||||
// sugar.Infow("New Twitch PrivateMessage",
|
||||
|
@ -194,6 +193,7 @@ func main() {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// openDB returns the sql.DB connection pool.
|
||||
|
|
|
@ -26,7 +26,7 @@ func Download(target, link string, tc *twitch.Client, log *zap.SugaredLogger) (r
|
|||
twitchClient: tc,
|
||||
}
|
||||
|
||||
dloader.dlxd(target, link)
|
||||
go dloader.dlxd(target, link)
|
||||
|
||||
return ""
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ func (dl *downloader) upload(target, path string) {
|
|||
}
|
||||
req.Header.Set("Content-Type", form.FormDataContentType())
|
||||
|
||||
httpClient := http.Client{}
|
||||
httpClient := http.DefaultClient
|
||||
resp, err := httpClient.Do(req)
|
||||
if err != nil {
|
||||
dl.twitchClient.Say(target, fmt.Sprintf("Something went wrong FeelsBadMan: %q", err))
|
||||
|
|
Loading…
Reference in a new issue