Skip to content

Commit

Permalink
feat: pip19 command
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy committed Jan 9, 2024
1 parent aaa722a commit 8474254
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions discord/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,24 @@ func (b *Bot) messageHandler(s *discordgo.Session, m *discordgo.MessageCreate) {
return
}

if m.Content == "pip19-score-average" {
totalValidators := float64(0)
sumScores := float64(0)

for i := 0; i < 3_000; i++ {
val, err := b.cm.GetValidatorInfoByNumber(int32(i))
if err != nil {
continue
}
totalValidators += 1
sumScores += val.Validator.AvailabilityScore
}

msg := fmt.Sprintf("average of %v validators pip19 score is %f", totalValidators, sumScores/totalValidators)
_, _ = s.ChannelMessageSendReply(m.ChannelID, msg, m.Reference())
return
}

// if m.Content == "pip19-report" {
// t := time.Now()

Expand Down

0 comments on commit 8474254

Please sign in to comment.