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 {
message := update.Message
sender := message.ForwardFrom
sender := message.From
d := db.GetDatabase()
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()

View File

@ -18,26 +18,27 @@ type bot struct {
}
func (b *bot) Update(update *tb.Update) {
if len(update.Message.NewChatMembers) != 0 {
for _, user := range update.Message.NewChatMembers {
if user.ID == b.Me.ID {
botAdded(b, update)
if update.Message != nil {
if len(update.Message.NewChatMembers) != 0 {
for _, user := range update.Message.NewChatMembers {
if user.ID == b.Me.ID {
botAdded(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)
userJoined(b, update)
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)
}
}
}