Skip to content

Commit

Permalink
chore: else if for facuet command
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy committed Dec 19, 2023
1 parent 0e3ce84 commit 55b4ec0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions discord/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ func (b *Bot) messageHandler(s *discordgo.Session, m *discordgo.MessageCreate) {
lastBlockTimeFormatted := time.Unix(int64(lastBlockTime), 0)

timeDiff := (uint32(currentTime.Unix()) - lastBlockTime)
if timeDiff> 15 {
msg := p.Sprintf("Network is **unhealthy❌**\nLast block time⛓️: %v\nCurrent time🕧: %v\nTime Difference: %v\nDifference is more than 15 seconds.",
if timeDiff > 15 {
msg := p.Sprintf("Network is **unhealthy❌**\nLast block time⛓️: %v\nCurrent time🕧: %v\nTime Difference: %v seconds\nDifference is more than 15 seconds.",
lastBlockTimeFormatted.Format("02/01/2006, 15:04:05"), currentTime.Format("02/01/2006, 15:04:05"), timeDiff)
_, _ = s.ChannelMessageSendReply(m.ChannelID, msg, m.Reference())
return
}

msg := p.Sprintf("Network is **healthy✅**\nLast block time⛓️: %v\nCurrent time🕧: %v\nTime Difference: %v\nDifference is less than 15 seconds.",
msg := p.Sprintf("Network is **healthy✅**\nLast block time⛓️: %v\nCurrent time🕧: %v\nTime Difference: %v seconds\nDifference is less than 15 seconds.",
lastBlockTimeFormatted.Format("02/01/2006, 15:04:05"), currentTime.Format("02/01/2006, 15:04:05"), timeDiff)
_, _ = s.ChannelMessageSendReply(m.ChannelID, msg, m.Reference())
return
Expand Down Expand Up @@ -274,9 +274,7 @@ func (b *Bot) messageHandler(s *discordgo.Session, m *discordgo.MessageCreate) {
return

}
}

if strings.Contains(strings.ToLower(m.Content), "faucet") {
} else if strings.Contains(strings.ToLower(m.Content), "faucet") {
trimmedPrefix := strings.TrimPrefix(strings.ToLower(m.Content), "faucet")
// faucet message must contain address/public-key
trimmedAddress := strings.Trim(trimmedPrefix, " ")
Expand Down

0 comments on commit 55b4ec0

Please sign in to comment.