Skip to content

Commit

Permalink
format hullDamage event value
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyblue committed Apr 3, 2021
1 parent 5299d43 commit a4953c1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion events.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package notifier

import (
"fmt"
"math"
)

type eventFn func(*Notifier, journalEvent) error
Expand All @@ -16,7 +17,8 @@ func hullDamageEvent(e *Notifier, j journalEvent) error {
prefix = "Fighter"
}

if err := e.bot.Send(fmt.Sprintf("%s hull damage detected, integrity is %2f", prefix, j.Health)); err != nil {
h := int(math.Round(j.Health * 100))
if err := e.bot.Send(fmt.Sprintf("%s hull damage detected, integrity is %d%%", prefix, h)); err != nil {
return fmt.Errorf("error sending message: %v", err)
}

Expand Down

0 comments on commit a4953c1

Please sign in to comment.