From e73584db1b179e0f43d7ce37066b6e06210e5cf1 Mon Sep 17 00:00:00 2001 From: Kay Date: Wed, 22 Nov 2023 15:26:20 +0000 Subject: [PATCH] chore: update time format --- discord/discord.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 }