3 Commits

Author SHA1 Message Date
d84b0a1b55 small fixes 2026-02-18 14:05:36 +03:00
434638a61d small fix; v0.6.1 2026-02-18 11:46:53 +03:00
c2909b4cfb small fix; v0.6.1 2026-02-18 11:46:48 +03:00
4 changed files with 9 additions and 6 deletions

View File

@@ -109,6 +109,9 @@ func (p *Plugin) AddCommand(command *Command) *Plugin {
p.Commands[command.command] = *command p.Commands[command.command] = *command
return p return p
} }
func (p *Plugin) NewCommand(exec CommandExecutor, command string, args ...CommandArg) *Command {
return NewCommand(exec, command, args...)
}
func (p *Plugin) AddPayload(command *Command) *Plugin { func (p *Plugin) AddPayload(command *Command) *Plugin {
p.Payloads[command.command] = *command p.Payloads[command.command] = *command
return p return p

View File

@@ -75,7 +75,7 @@ func (r TelegramRequest[R, P]) DoWithContext(ctx context.Context, api *API) (R,
} }
api.Logger.Debugln("RES", r.method, string(data)) api.Logger.Debugln("RES", r.method, string(data))
if res.StatusCode != http.StatusOK { if res.StatusCode != http.StatusOK {
return zero, fmt.Errorf("unexpected status code: %d", res.StatusCode) return zero, fmt.Errorf("unexpected status code: %d, %s", res.StatusCode, string(data))
} }
var resp ApiResponse[R] var resp ApiResponse[R]

View File

@@ -108,9 +108,6 @@ func (u UploaderRequest[R, P]) DoWithContext(ctx context.Context, up *Uploader)
return zero, err return zero, err
} }
defer res.Body.Close() defer res.Body.Close()
if res.StatusCode != http.StatusOK {
return zero, fmt.Errorf("unexpected status code: %d", res.StatusCode)
}
reader := io.LimitReader(res.Body, 10<<20) reader := io.LimitReader(res.Body, 10<<20)
body, err := io.ReadAll(reader) body, err := io.ReadAll(reader)
@@ -118,6 +115,9 @@ func (u UploaderRequest[R, P]) DoWithContext(ctx context.Context, up *Uploader)
return zero, err return zero, err
} }
up.logger.Debugln("UPLOADER RES", u.method, string(body)) up.logger.Debugln("UPLOADER RES", u.method, string(body))
if res.StatusCode != http.StatusOK {
return zero, fmt.Errorf("unexpected status code: %d, %s", res.StatusCode, string(body))
}
var resp ApiResponse[R] var resp ApiResponse[R]
err = json.Unmarshal(body, &resp) err = json.Unmarshal(body, &resp)

View File

@@ -1,8 +1,8 @@
package utils package utils
const ( const (
VersionString = "0.6.0" VersionString = "0.6.2"
VersionMajor = 0 VersionMajor = 0
VersionMinor = 6 VersionMinor = 6
VersionPatch = 0 VersionPatch = 2
) )