Fixed typos

This commit is contained in:
nefrace 2022-11-09 01:23:32 +03:00
parent 43f881178b
commit a64c173c1a
2 changed files with 19 additions and 18 deletions

View File

@ -71,7 +71,7 @@ func userLeft(b *bot, update *tb.Update) error {
func checkCaptcha(b *bot, update *tb.Update) error { func checkCaptcha(b *bot, update *tb.Update) error {
message := update.Message message := update.Message
sender := message.ForwardFrom sender := message.From
d := db.GetDatabase() 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()

View File

@ -18,26 +18,27 @@ type bot struct {
} }
func (b *bot) Update(update *tb.Update) { func (b *bot) Update(update *tb.Update) {
if len(update.Message.NewChatMembers) != 0 { if update.Message != nil {
for _, user := range update.Message.NewChatMembers { if len(update.Message.NewChatMembers) != 0 {
if user.ID == b.Me.ID { for _, user := range update.Message.NewChatMembers {
botAdded(b, update) if user.ID == b.Me.ID {
botAdded(b, update)
}
} }
} userJoined(b, update)
userJoined(b, update)
return
}
if update.Message.LeftChatMember != nil {
userLeft(b, update)
return
}
if update.Message.Text != "" {
if update.Message.Text == "/settopic" {
setTopic(b, update)
return return
} }
checkCaptcha(b, update) if update.Message.LeftChatMember != nil {
userLeft(b, update)
return
}
if update.Message.Text != "" {
if update.Message.Text == "/settopic" {
setTopic(b, update)
return
}
checkCaptcha(b, update)
}
} }
} }