mirror of
https://github.com/HugeFrog24/go-telegram-bot.git
synced 2026-06-29 22:07:12 +00:00
Satisfy linter
This commit is contained in:
+3
-3
@@ -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
@@ -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
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user