discord: retry auth/command register, do latter in bulk

re-use the auth retry options from the config for initial d.bot.Open and
for registering commands. The latetr is now done with the BulkOverwrite
    method, since it seems to work now. For #427.
This commit is contained in:
Harvey Tindall
2025-08-03 20:05:22 +01:00
parent aab8d6ed77
commit db1e812190
3 changed files with 70 additions and 12 deletions

View File

@@ -11,6 +11,7 @@ import (
"net/http"
"net/url"
"strings"
"time"
lm "github.com/hrfee/jfa-go/logmessages"
)
@@ -155,3 +156,11 @@ func decodeResp(resp *http.Response) (string, error) {
}
return buf.String(), nil
}
// MustAuthenticateOptions is used to control the behaviour of the MustAuthenticate-like methods.
type MustAuthenticateOptions struct {
RetryCount int // Number of Retries before failure.
RetryGap time.Duration // Duration to wait between tries.
LogFailures bool // Whether or not to print failures to the log.
Counter int // The current retry count.
}