minor-bug-fixes #177

Merged
lash merged 26 commits from minor-bug-fixes into master 2024-12-03 18:18:23 +01:00
Showing only changes of commit c46f41e25f - Show all commits

View File

@ -811,7 +811,16 @@ func (h *Handlers) CheckBalance(ctx context.Context, sym string, input []byte) (
return res, err return res, err
} }
balStr := fmt.Sprintf("%s %s", activeBal, activeSym) // Convert activeBal from []byte to float64
balFloat, err := strconv.ParseFloat(string(activeBal), 64)
if err != nil {
logg.ErrorCtxf(ctx, "failed to parse activeBal as float", "value", string(activeBal), "error", err)
return res, err
}
// Format to 2 decimal places
balStr := fmt.Sprintf("%.2f %s", balFloat, activeSym)
res.Content = l.Get("Balance: %s\n", balStr) res.Content = l.Get("Balance: %s\n", balStr)
return res, nil return res, nil