diff --git a/discord/discord.go b/discord/discord.go index cd72969..2705232 100644 --- a/discord/discord.go +++ b/discord/discord.go @@ -108,18 +108,19 @@ func (b *Bot) messageHandler(s *discordgo.Session, m *discordgo.MessageCreate) { } if strings.ToLower(m.Content) == "health" { - currentTime := time.Now().Unix() + currentTime := time.Now() lastBlockTime := b.cm.GetLastBlockTime() + lastBlockTimeFormatted := time.Unix(int64(lastBlockTime), 0) - if (uint32(currentTime) - lastBlockTime) > 15 { + if (uint32(currentTime.Unix()) - lastBlockTime) > 15 { msg := p.Sprintf("Network is unhealthy\nlast block time: %v\ncurrent time: %v\nDifference is more than 15 seconds.", - lastBlockTime, currentTime) + lastBlockTimeFormatted.Format("02/01/2006, 15:04:05"), currentTime.Format("02/01/2006, 15:04:05")) _, _ = s.ChannelMessageSendReply(m.ChannelID, msg, m.Reference()) return } msg := p.Sprintf("Network is **healthy**\nlast block time: %v\ncurrent time: %v\nDifference is less than 15 seconds.", - lastBlockTime, currentTime) + lastBlockTimeFormatted.Format("02/01/2006, 15:04:05"), currentTime.Format("02/01/2006, 15:04:05")) _, _ = s.ChannelMessageSendReply(m.ChannelID, msg, m.Reference()) return }