fix: tests and linter issues
This commit is contained in:
parent
8145622c54
commit
f4b46246eb
2 changed files with 8 additions and 1 deletions
|
|
@ -212,7 +212,12 @@ func (c *TelegramChannel) Send(ctx context.Context, msg bus.OutboundMessage) err
|
||||||
|
|
||||||
// sendChunk sends a single HTML/MarkdownV2 message, falling back to the original
|
// sendChunk sends a single HTML/MarkdownV2 message, falling back to the original
|
||||||
// markdown as plain text on parse failure so users never see raw HTML/MarkdownV2 tags.
|
// markdown as plain text on parse failure so users never see raw HTML/MarkdownV2 tags.
|
||||||
func (c *TelegramChannel) sendChunk(ctx context.Context, chatID int64, content, mdFallback string, useMarkdownV2 bool) error {
|
func (c *TelegramChannel) sendChunk(
|
||||||
|
ctx context.Context,
|
||||||
|
chatID int64,
|
||||||
|
content, mdFallback string,
|
||||||
|
useMarkdownV2 bool,
|
||||||
|
) error {
|
||||||
tgMsg := tu.Message(tu.ID(chatID), content)
|
tgMsg := tu.Message(tu.ID(chatID), content)
|
||||||
if useMarkdownV2 {
|
if useMarkdownV2 {
|
||||||
tgMsg.WithParseMode(telego.ModeMarkdownV2)
|
tgMsg.WithParseMode(telego.ModeMarkdownV2)
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import (
|
||||||
|
|
||||||
"github.com/sipeed/picoclaw/pkg/bus"
|
"github.com/sipeed/picoclaw/pkg/bus"
|
||||||
"github.com/sipeed/picoclaw/pkg/channels"
|
"github.com/sipeed/picoclaw/pkg/channels"
|
||||||
|
"github.com/sipeed/picoclaw/pkg/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
const testToken = "1234567890:aaaabbbbaaaabbbbaaaabbbbaaaabbbbccc"
|
const testToken = "1234567890:aaaabbbbaaaabbbbaaaabbbbaaaabbbbccc"
|
||||||
|
|
@ -77,6 +78,7 @@ func newTestChannel(t *testing.T, caller *stubCaller) *TelegramChannel {
|
||||||
BaseChannel: base,
|
BaseChannel: base,
|
||||||
bot: bot,
|
bot: bot,
|
||||||
chatIDs: make(map[string]int64),
|
chatIDs: make(map[string]int64),
|
||||||
|
config: config.DefaultConfig(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue