Skip to content

Commit

Permalink
feat: adding AvailabilityScore
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy committed Jan 7, 2024
1 parent 59b6798 commit 9565aee
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions discord/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ func (b *Bot) messageHandler(s *discordgo.Session, m *discordgo.MessageCreate) {
return
}

score := ""
if val.Validator.AvailabilityScore < 0.8 {
score = fmt.Sprintf("%v⚠️⚠️", val.Validator.AvailabilityScore)
}

if val.Validator.AvailabilityScore > 0.8 {
score = fmt.Sprintf("%v🟢✅", val.Validator.AvailabilityScore)
}

msg := p.Sprintf("Peer info\n")
msg += p.Sprintf("Peer ID: %v\n", peerID)
msg += p.Sprintf("IP address: %v\n", peerInfo.Address)
Expand All @@ -175,10 +184,10 @@ func (b *Bot) messageHandler(s *discordgo.Session, m *discordgo.MessageCreate) {
msg += p.Sprintf("ISP: %v\n", geoData.ISP)
msg += p.Sprintf("--------------------Validator Info----------------\n")
msg += p.Sprintf("Number: %v\n", val.Validator.Number)
msg += p.Sprintf("**Availability score: %v\n**", score)
msg += p.Sprintf("**Stake amount: %v tPAC's**\n", util.ChangeToCoin(val.Validator.Stake))
msg += p.Sprintf("Last bonding height: %v\n", val.Validator.LastBondingHeight)
msg += p.Sprintf("Last sortition height: %v\n", val.Validator.LastSortitionHeight)
msg += p.Sprintf("Availability score: %v\n", val.Validator.AvailabilityScore)
msg += p.Sprintf("Stake amount: %v tPAC's\n", util.ChangeToCoin(val.Validator.Stake))
_, _ = s.ChannelMessageSendReply(m.ChannelID, msg, m.Reference())
return
}
Expand Down

0 comments on commit 9565aee

Please sign in to comment.