fix: send messages to channel on message

This commit is contained in:
skeris 2023-05-06 19:36:11 +03:00
parent d68e990134
commit 00c539f6e8
2 changed files with 7 additions and 8 deletions

@ -126,9 +126,8 @@ func New(ctx context.Context, opts interface{}, ver appInit.Version) (appInit.Co
}
var newBot *tb.Bot
/*if options.LoggerDevMode {
newBot, err = tb.NewBot(tb.Settings{
Token: "5240336345:AAG6ZXm6IYqsIZn7SoJTltJWviOXhVa4D0c",
Token: "5851043588:AAGXhigZAaNV1--n-jfS8eBgM7iZ2IDm668",
Verbose: false,
ParseMode: tb.ModeHTML,
Poller: &tb.LongPoller{
@ -139,7 +138,6 @@ func New(ctx context.Context, opts interface{}, ver appInit.Version) (appInit.Co
//logger.Emit(json.Token(err))
return nil, err
}
}*/
heruvym := service.New(blobStore, database, logger, newBot)

@ -294,7 +294,9 @@ func (h *Heruvym) PutMessage(
}
go func() {
if sess.Id != "" {
/*if sess.Id != "" {
additional, err := h.dal.GetAdditionalData(context.TODO(), sess.Id)
fmt.Println("CAN NOT NOTIFY", err)
if err == nil && h.notifier != nil {
additional, err := h.dal.GetAdditionalData(context.TODO(), sess.Id)
@ -306,18 +308,17 @@ func (h *Heruvym) PutMessage(
}
return
}
}
}*/
if h.notifier != nil {
if _, err := h.notifier.Send(tb.ChatID(-1001344671794),
if _, err := h.notifier.Send(tb.ChatID(-1001802261459),
fmt.Sprintf(
"Поступило новое сообщение от незарегистриованного пользователя")); err != nil {
"Поступило новое сообщение")); err != nil {
fmt.Println("CAN NOT NOTIFY", err)
}
}
}()
if err := h.dal.UpdateTopMessage(ctx, request.TicketID, message); err != nil {
fmt.Println("PUTMES2", err)
return errors.New("can not update ticket"), http.StatusInternalServerError
}