Satisfy linter

This commit is contained in:
HugeFrog24
2026-05-28 21:01:23 +02:00
parent d97a2c3132
commit a2cc252e8f
4 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -105,9 +105,9 @@ func parseMissingFileIDFromBody(raw string) string {
// quotes, so the id ends at the first character outside the alphanumeric + // quotes, so the id ends at the first character outside the alphanumeric +
// underscore set. // underscore set.
end := strings.IndexFunc(rest, func(r rune) bool { end := strings.IndexFunc(rest, func(r rune) bool {
return !(r >= 'a' && r <= 'z') && return (r < 'a' || r > 'z') &&
!(r >= 'A' && r <= 'Z') && (r < 'A' || r > 'Z') &&
!(r >= '0' && r <= '9') && (r < '0' || r > '9') &&
r != '_' r != '_'
}) })
if end == -1 { if end == -1 {
+2 -2
View File
@@ -42,7 +42,7 @@ func (b *Bot) generateSpeech(ctx context.Context, text string) (io.Reader, error
return nil, fmt.Errorf("elevenlabs TTS error: %w", err) return nil, fmt.Errorf("elevenlabs TTS error: %w", err)
} }
if resp.StatusCode != http.StatusOK { if resp.StatusCode != http.StatusOK {
defer resp.Body.Close() defer func() { _ = resp.Body.Close() }()
errBody, _ := io.ReadAll(resp.Body) errBody, _ := io.ReadAll(resp.Body)
return nil, fmt.Errorf("elevenlabs TTS error: status %d: %s", resp.StatusCode, errBody) return nil, fmt.Errorf("elevenlabs TTS error: status %d: %s", resp.StatusCode, errBody)
} }
@@ -90,7 +90,7 @@ func (b *Bot) transcribeVoice(ctx context.Context, fileID string) (string, error
if err != nil { if err != nil {
return "", fmt.Errorf("elevenlabs STT request error: %w", err) return "", fmt.Errorf("elevenlabs STT request error: %w", err)
} }
defer sttResp.Body.Close() defer func() { _ = sttResp.Body.Close() }()
if sttResp.StatusCode != http.StatusOK { if sttResp.StatusCode != http.StatusOK {
body, _ := io.ReadAll(sttResp.Body) body, _ := io.ReadAll(sttResp.Body)
Binary file not shown.
+1 -1
View File
@@ -50,7 +50,7 @@ func (b *Bot) downloadTelegramFile(ctx context.Context, fileID string) ([]byte,
if err != nil { if err != nil {
return nil, fmt.Errorf("telegram download %s: %w", fileID, err) return nil, fmt.Errorf("telegram download %s: %w", fileID, err)
} }
defer resp.Body.Close() defer func() { _ = resp.Body.Close() }()
if resp.StatusCode != http.StatusOK { if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("telegram download %s: status %d", fileID, resp.StatusCode) return nil, fmt.Errorf("telegram download %s: status %d", fileID, resp.StatusCode)
} }