fix: убран префикс tg:// из chat_id при отправке (chat not found); тесты проверяют ChatID
All checks were successful
CI / test (push) Successful in 54s
CI / build-and-package (amd64, darwin) (push) Successful in 45s
CI / build-and-package (amd64, linux) (push) Successful in 46s
CI / build-and-package (amd64, windows) (push) Successful in 46s
CI / build-and-package (arm64, darwin) (push) Successful in 44s
CI / build-and-package (arm64, linux) (push) Successful in 47s
All checks were successful
CI / test (push) Successful in 54s
CI / build-and-package (amd64, darwin) (push) Successful in 45s
CI / build-and-package (amd64, linux) (push) Successful in 46s
CI / build-and-package (amd64, windows) (push) Successful in 46s
CI / build-and-package (arm64, darwin) (push) Successful in 44s
CI / build-and-package (arm64, linux) (push) Successful in 47s
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/kamelion/ratatoskr-go/internal/chat"
|
||||
@@ -71,8 +72,12 @@ func (ch *Channel) Run(ctx context.Context) error {
|
||||
}
|
||||
}
|
||||
|
||||
// tgPrefix — префикс адреса чата в ratatoskr (см. handleUpdate).
|
||||
// В Bot API chat_id передаётся без него.
|
||||
const tgPrefix = "tg://"
|
||||
|
||||
func (ch *Channel) Send(_ context.Context, to chat.Address, m chat.Message) error {
|
||||
return ch.sendMsg(string(to), formatOutgoing(m))
|
||||
return ch.sendMsg(strings.TrimPrefix(string(to), tgPrefix), formatOutgoing(m))
|
||||
}
|
||||
|
||||
func (ch *Channel) Ask(_ context.Context, to chat.Address, m chat.Message) error {
|
||||
|
||||
Reference in New Issue
Block a user