Compare commits
	
		
			2 Commits
		
	
	
		
			75454a3233
			...
			bb0862ba8b
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| bb0862ba8b | |||
| 1c4a0adb61 | 
@ -55,14 +55,16 @@ func (b *Kicker) NewBot(chatID int64) echotron.Bot {
 | 
				
			|||||||
	store := tongo.NewStore[db.Chat](Client)
 | 
						store := tongo.NewStore[db.Chat](Client)
 | 
				
			||||||
	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
 | 
						ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
 | 
				
			||||||
	defer cancel()
 | 
						defer cancel()
 | 
				
			||||||
	chat := db.Chat{
 | 
					
 | 
				
			||||||
		Item:    tongo.NewID(),
 | 
						chat, err := store.GetOne(ctx, tongo.E("chat_id", chatID))
 | 
				
			||||||
		ChatId:  chatID,
 | 
						if err != nil {
 | 
				
			||||||
		Title:   "",
 | 
							chat = &db.Chat{
 | 
				
			||||||
		TopicId: 0,
 | 
								Item:    tongo.NewID(),
 | 
				
			||||||
	}
 | 
								ChatId:  chatID,
 | 
				
			||||||
	if _, err := store.GetOne(ctx, tongo.E("chat_id", chatID)); err != nil {
 | 
								Title:   "",
 | 
				
			||||||
		if _, err := store.InsertOne(ctx, &chat); err != nil {
 | 
								TopicId: 0,
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							if _, err := store.InsertOne(ctx, chat); err != nil {
 | 
				
			||||||
			return &bot{}
 | 
								return &bot{}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -73,6 +75,7 @@ func (b *Kicker) NewBot(chatID int64) echotron.Bot {
 | 
				
			|||||||
		nil,
 | 
							nil,
 | 
				
			||||||
		echotron.NewAPI(b.Token),
 | 
							echotron.NewAPI(b.Token),
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						log.Println("New bot created with CaptchaTopic", result.CaptchaTopic)
 | 
				
			||||||
	me, err := result.GetMe()
 | 
						me, err := result.GetMe()
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		log.Println(err)
 | 
							log.Println(err)
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user