From 4608c096560752b67795e9a06d1fc9c1e5d83ded Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 4 Jul 2020 16:21:41 +0300 Subject: [PATCH] Escape % in battery low warning. Fixes #205 --- user.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/user.go b/user.go index 74a3ca4..09f08f7 100644 --- a/user.go +++ b/user.go @@ -685,10 +685,10 @@ func (user *User) HandleBatteryMessage(battery whatsapp.BatteryMessage) { user.log.Debugfln("Battery message: %+v", battery) var notice string if !battery.Plugged && battery.Percentage < 15 && user.batteryWarningsSent < 1 { - notice = fmt.Sprintf("Phone battery low (%d % remaining)", battery.Percentage) + notice = fmt.Sprintf("Phone battery low (%d %% remaining)", battery.Percentage) user.batteryWarningsSent = 1 } else if !battery.Plugged && battery.Percentage < 5 && user.batteryWarningsSent < 2 { - notice = fmt.Sprintf("Phone battery very low (%d % remaining)", battery.Percentage) + notice = fmt.Sprintf("Phone battery very low (%d %% remaining)", battery.Percentage) user.batteryWarningsSent = 2 } else if battery.Percentage > 15 || battery.Plugged { user.batteryWarningsSent = 0