From 5be952483fbf6350290461ad901268d0e837a497 Mon Sep 17 00:00:00 2001 From: Astra Date: Wed, 28 Jan 2026 15:57:23 +0000 Subject: [PATCH] Remove mock data --- .gitignore | 1 + main.go | 58 ++++++------------------------------------------------ 2 files changed, 7 insertions(+), 52 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b6b072 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config.yaml diff --git a/main.go b/main.go index 317a499..4e890de 100644 --- a/main.go +++ b/main.go @@ -43,53 +43,7 @@ func main() { updateConfig.Timeout = 60 updatesChannel := b.API.GetUpdatesChan(updateConfig) - var updatesChannelMock chan api.Update = make(chan api.Update, 1) - mockUpdates := []api.Update{ - { - ChatJoinRequest: &api.ChatJoinRequest{ - Chat: api.Chat{ - ID: -1001895847484, - Type: "supergroup", - Title: "Example Group", - }, - From: api.User{ - ID: 55258520, - FirstName: "Astra", - LastName: "Doe", - UserName: "asstra", - }, - Date: int(time.Now().Unix()), - UserChatID: 55258520, - }, - }, - { - Message: &api.Message{ - MessageID: 1, - From: &api.User{ - ID: 55258520, - FirstName: "Astra", - LastName: "Doe", - UserName: "asstra", - }, - Chat: api.Chat{ - ID: 55258520, - Type: "private", - }, - Date: int(time.Now().Unix()), - Text: "I would like to join because *I* test love this group!", - }, - }, - } - - go func() { - for _, update := range mockUpdates { - updatesChannelMock <- update - time.Sleep(2 * time.Second) // delay between updates - } - close(updatesChannelMock) - }() - - for update := range updatesChannel { //Mock { + for update := range updatesChannel { if update.ChatJoinRequest != nil { b.handleJoinRequest(update.ChatJoinRequest) continue @@ -131,12 +85,12 @@ func (bot *Bot) handleJoinRequestResponse(user *ExtendedChatJoinRequest, update ack := api.NewMessage(update.From.ID, "Thank you! Your request has been sent to the admins for review.") bot.API.Send(ack) } else { - if user.Date+(60*60*5) < int(time.Now().Unix()) { + // if user.Date+(60*60*5) < int(time.Now().Unix()) { - } else { - m := api.NewMessage(update.From.ID, "Your request is already pending approval.") - bot.API.Send(m) - } + // } else { + m := api.NewMessage(update.From.ID, "Your request is already pending approval.") + bot.API.Send(m) + // } } }