fix: port main branch changes to channel subpackages after rebase

Port changes that were applied to the old pkg/channels/*.go files on main
to their new locations in channel subpackages:
- telegram: precompile regex, var transcribedText, GetModelName()
- discord: var transcribedText declaration
- onebot: resp.Body.Close(), "canceled" spelling, remove empty line
- slack: named return values in parseSlackChatID
- wecom: remove sendMarkdownMessage dead code
- whatsapp: resp.Body.Close() after Dial
- gateway/helpers: remove unused errors import
This commit is contained in:
Hoshina
2026-02-26 23:24:35 +08:00
parent 1d4fe4652a
commit 35a035bdda
9 changed files with 37 additions and 85 deletions
+5 -3
View File
@@ -172,7 +172,10 @@ func (c *OneBotChannel) connect() error {
header["Authorization"] = []string{"Bearer " + c.config.AccessToken}
}
conn, _, err := dialer.Dial(c.config.WSUrl, header)
conn, resp, err := dialer.Dial(c.config.WSUrl, header)
if resp != nil {
resp.Body.Close()
}
if err != nil {
return err
}
@@ -313,7 +316,7 @@ func (c *OneBotChannel) sendAPIRequest(action string, params any, timeout time.D
case <-time.After(timeout):
return nil, fmt.Errorf("API request %s timed out after %v", action, timeout)
case <-c.ctx.Done():
return nil, fmt.Errorf("context cancelled")
return nil, fmt.Errorf("context canceled")
}
}
@@ -815,7 +818,6 @@ func (c *OneBotChannel) parseMessageSegments(
textParts = append(textParts, "[forward message]")
default:
}
}