Escape % in battery low warning. Fixes #205
This commit is contained in:
parent
43a3815970
commit
4608c09656
4
user.go
4
user.go
@ -685,10 +685,10 @@ func (user *User) HandleBatteryMessage(battery whatsapp.BatteryMessage) {
|
|||||||
user.log.Debugfln("Battery message: %+v", battery)
|
user.log.Debugfln("Battery message: %+v", battery)
|
||||||
var notice string
|
var notice string
|
||||||
if !battery.Plugged && battery.Percentage < 15 && user.batteryWarningsSent < 1 {
|
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
|
user.batteryWarningsSent = 1
|
||||||
} else if !battery.Plugged && battery.Percentage < 5 && user.batteryWarningsSent < 2 {
|
} 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
|
user.batteryWarningsSent = 2
|
||||||
} else if battery.Percentage > 15 || battery.Plugged {
|
} else if battery.Percentage > 15 || battery.Plugged {
|
||||||
user.batteryWarningsSent = 0
|
user.batteryWarningsSent = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user