This commit is contained in:
Stephan D
2026-03-10 12:31:09 +01:00
parent d87e709f43
commit e77d1ab793
287 changed files with 2089 additions and 1550 deletions

View File

@@ -186,7 +186,11 @@ func (c *client) sendMessage(ctx context.Context, payload sendMessagePayload) (*
c.logger.Warn("Telegram request failed", zap.Error(err))
return nil, err
}
defer resp.Body.Close()
defer func() {
if closeErr := resp.Body.Close(); closeErr != nil {
c.logger.Warn("Failed to close telegram response body", zap.Error(closeErr))
}
}()
respBody, _ := io.ReadAll(io.LimitReader(resp.Body, 16<<10))
if resp.StatusCode >= http.StatusOK && resp.StatusCode < http.StatusMultipleChoices {
@@ -321,7 +325,11 @@ func (c *client) sendReaction(ctx context.Context, payload setMessageReactionPay
c.logger.Warn("Telegram reaction request failed", zap.Error(err))
return err
}
defer resp.Body.Close()
defer func() {
if closeErr := resp.Body.Close(); closeErr != nil {
c.logger.Warn("Failed to close telegram reaction response body", zap.Error(closeErr))
}
}()
respBody, _ := io.ReadAll(io.LimitReader(resp.Body, 16<<10))
if resp.StatusCode >= http.StatusOK && resp.StatusCode < http.StatusMultipleChoices {