Fixed deleting join message
This commit is contained in:
parent
c6abbbef1d
commit
e0972d8a2a
|
@ -22,6 +22,10 @@ func userJoined(b *bot, update *echotron.Update) error {
|
|||
store := tongo.NewStore[db.User](Client)
|
||||
usr := update.Message.NewChatMembers[0]
|
||||
message := update.Message
|
||||
_, err := b.DeleteMessage(message.Chat.ID, message.ID)
|
||||
if err != nil {
|
||||
log.Printf("Can't delete message: %v", err)
|
||||
}
|
||||
user, err := store.GetOne(ctx, tongo.E("chat_id", update.ChatID()), tongo.E("user_id", usr.ID))
|
||||
var captcha *captchagen.Captcha
|
||||
if err != nil {
|
||||
|
@ -47,10 +51,6 @@ func userJoined(b *bot, update *echotron.Update) error {
|
|||
if captcha == nil {
|
||||
return nil
|
||||
}
|
||||
_, err = b.DeleteMessage(message.Chat.ID, message.ID)
|
||||
if err != nil {
|
||||
log.Printf("Can't delete message: %v", err)
|
||||
}
|
||||
bytes, err := captcha.ToBytes()
|
||||
if err != nil {
|
||||
log.Printf("Error creating captcha bytes: %v", bytes)
|
||||
|
|
Loading…
Reference in New Issue