Fixed getting chat from checkCaptcha
This commit is contained in:
parent
8f661d68a1
commit
23d4e9893e
|
@ -77,12 +77,13 @@ func checkCaptcha(b *bot, update *echotron.Update) error {
|
||||||
message := update.Message
|
message := update.Message
|
||||||
sender := message.From
|
sender := message.From
|
||||||
store := tongo.NewStore[db.User](Client)
|
store := tongo.NewStore[db.User](Client)
|
||||||
d := db.GetDatabase()
|
chatStore := tongo.NewStore[db.Chat](Client)
|
||||||
|
// d := db.GetDatabase()
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
if user, err := store.GetOne(ctx, tongo.E("user_id", sender.ID), tongo.E("chat_id", message.Chat.ID)); err == nil { //d.GetUser(ctx, db.User{UserId: sender.ID, ChatId: message.Chat.ID}); err == nil {
|
if user, err := store.GetOne(ctx, tongo.E("user_id", sender.ID), tongo.E("chat_id", message.Chat.ID)); err == nil { //d.GetUser(ctx, db.User{UserId: sender.ID, ChatId: message.Chat.ID}); err == nil {
|
||||||
if message.Chat.IsForum {
|
if message.Chat.IsForum {
|
||||||
chat, err := d.GetChat(ctx, message.Chat.ID)
|
chat, err := chatStore.GetOne(ctx, tongo.E("chat_id", message.Chat.ID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue