Skip to content

Commit

Permalink
fixed indexed events
Browse files Browse the repository at this point in the history
  • Loading branch information
JackBekket committed Sep 22, 2022
1 parent 69c10ce commit aa8bc16
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type event_bc = *passport.PassportPassportApplied

// channel to get this event from blockchain
var ch = make(chan *passport.PassportPassportApplied)
var ch_index = make(chan *passport.PassportPassportAppliedIndexed)

//main database for dialogs, key (int64) is telegram user id
var userDatabase = make(map[int64]user) // consider to change in persistend data storage?
Expand Down Expand Up @@ -169,7 +170,9 @@ func main() {
msg = tgbotapi.NewMessage(userDatabase[update.Message.From.ID].tgid, link)
bot.Send(msg)

subscription, err := SubscribeForApplications(session, ch)
//subscription, err := SubscribeForApplications(session, ch)
subscription, err := SubscribeForApplicationsIndexed(session, ch_index,tgid_array)

if err != nil {
log.Fatal(err)
}
Expand All @@ -181,7 +184,7 @@ func main() {
subscription.Unsubscribe()
break EventLoop
}
case eventResult := <-ch:
case eventResult := <-ch_index:
{
//fmt.Println("\n")
fmt.Println("User tg_id:", eventResult.ApplyerTg)
Expand Down

0 comments on commit aa8bc16

Please sign in to comment.