change: shorten progress bar to fit iPhone screen

poor iPhone user :(
This commit is contained in:
Yiyang Kang 2022-11-26 21:05:25 +08:00
parent ce171109c8
commit afc70788b6
1 changed files with 2 additions and 2 deletions

4
bot.go
View File

@ -220,7 +220,7 @@ func drawBarForTrafficRecord(r stats.VnstatTrafficRecord) string {
effective := lo.Max([]uint64{r.Rx, r.Tx}) effective := lo.Max([]uint64{r.Rx, r.Tx})
max := config.MonthlyTrafficLimitGiB max := config.MonthlyTrafficLimitGiB
ratio := float64(effective) / 1024 / 1024 / 1024 / float64(max) ratio := float64(effective) / 1024 / 1024 / 1024 / float64(max)
return fmt.Sprintf("`%s %2.0f%%`", drawBar(ratio, 25), ratio*100) return fmt.Sprintf("`%s %2.0f%%`", drawBar(ratio, 16), ratio*100)
} }
func handleYearProgressCmd(c tele.Context) error { func handleYearProgressCmd(c tele.Context) error {
@ -232,7 +232,7 @@ func handleYearProgressCmd(c tele.Context) error {
replyText := fmt.Sprintf( replyText := fmt.Sprintf(
"\n%d is <b>%2.0f%%</b> complete.\n<pre>%s</pre>", "\n%d is <b>%2.0f%%</b> complete.\n<pre>%s</pre>",
time.Now().Year(), ratio*100, drawBar(ratio, 25), time.Now().Year(), ratio*100, drawBar(ratio, 20),
) )
return c.Reply(replyText, &tele.SendOptions{ParseMode: tele.ModeHTML}, tele.Silent) return c.Reply(replyText, &tele.SendOptions{ParseMode: tele.ModeHTML}, tele.Silent)
} }