diff --git a/anthropic_files.go b/anthropic_files.go index 2a343e8..7ca2ae0 100644 --- a/anthropic_files.go +++ b/anthropic_files.go @@ -105,9 +105,9 @@ func parseMissingFileIDFromBody(raw string) string { // quotes, so the id ends at the first character outside the alphanumeric + // underscore set. end := strings.IndexFunc(rest, func(r rune) bool { - return !(r >= 'a' && r <= 'z') && - !(r >= 'A' && r <= 'Z') && - !(r >= '0' && r <= '9') && + return (r < 'a' || r > 'z') && + (r < 'A' || r > 'Z') && + (r < '0' || r > '9') && r != '_' }) if end == -1 { diff --git a/elevenlabs.go b/elevenlabs.go index 7433d23..a4e06b3 100644 --- a/elevenlabs.go +++ b/elevenlabs.go @@ -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) } if resp.StatusCode != http.StatusOK { - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() errBody, _ := io.ReadAll(resp.Body) 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 { return "", fmt.Errorf("elevenlabs STT request error: %w", err) } - defer sttResp.Body.Close() + defer func() { _ = sttResp.Body.Close() }() if sttResp.StatusCode != http.StatusOK { body, _ := io.ReadAll(sttResp.Body) diff --git a/go-telegram-bot.exe b/go-telegram-bot.exe index 0f5ad56..c2249d4 100644 Binary files a/go-telegram-bot.exe and b/go-telegram-bot.exe differ diff --git a/telegram_helpers.go b/telegram_helpers.go index 3da8b4f..4a02a31 100644 --- a/telegram_helpers.go +++ b/telegram_helpers.go @@ -50,7 +50,7 @@ func (b *Bot) downloadTelegramFile(ctx context.Context, fileID string) ([]byte, if err != nil { return nil, fmt.Errorf("telegram download %s: %w", fileID, err) } - defer resp.Body.Close() + defer func() { _ = resp.Body.Close() }() if resp.StatusCode != http.StatusOK { return nil, fmt.Errorf("telegram download %s: status %d", fileID, resp.StatusCode) }