add log
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
284221c0f7
commit
ea51cdda8f
|
@ -6,9 +6,8 @@ import (
|
|||
"log"
|
||||
"strconv"
|
||||
|
||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||
|
||||
"git.3crabs.ru/VLADIMIR/butler/internal/modules/messenger"
|
||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||
)
|
||||
|
||||
type messengerTelegram struct {
|
||||
|
@ -34,8 +33,15 @@ func NewMessengerTelegram(token string) (messenger.IMessenger, error) {
|
|||
|
||||
func (m *messengerTelegram) GetMessage(ctx context.Context) (*messenger.Message, error) {
|
||||
tgMsg := <-m.updates
|
||||
chatID := int64(0)
|
||||
if tgMsg.Message.Chat != nil {
|
||||
chatID = tgMsg.Message.Chat.ID
|
||||
}
|
||||
if chatID == 0 {
|
||||
return nil, fmt.Errorf("get chat id error %+v", tgMsg)
|
||||
}
|
||||
msg := &messenger.Message{
|
||||
ChatID: fmt.Sprintf("%d", tgMsg.Message.Chat.ID),
|
||||
ChatID: fmt.Sprintf("%d", chatID),
|
||||
UserID: tgMsg.Message.From.UserName,
|
||||
Text: tgMsg.Message.Text,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue