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)
|
store := tongo.NewStore[db.User](Client)
|
||||||
usr := update.Message.NewChatMembers[0]
|
usr := update.Message.NewChatMembers[0]
|
||||||
message := update.Message
|
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))
|
user, err := store.GetOne(ctx, tongo.E("chat_id", update.ChatID()), tongo.E("user_id", usr.ID))
|
||||||
var captcha *captchagen.Captcha
|
var captcha *captchagen.Captcha
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -47,10 +51,6 @@ func userJoined(b *bot, update *echotron.Update) error {
|
||||||
if captcha == nil {
|
if captcha == nil {
|
||||||
return 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()
|
bytes, err := captcha.ToBytes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error creating captcha bytes: %v", bytes)
|
log.Printf("Error creating captcha bytes: %v", bytes)
|
||||||
|
|
Loading…
Reference in New Issue