From 1eb93a80a2bb707f031ebb426890e233a7617a7e Mon Sep 17 00:00:00 2001 From: shoopea Date: Fri, 11 Oct 2019 15:45:53 +0800 Subject: [PATCH] update vault status --- job.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/job.go b/job.go index 52b5bdd..b8fc6e4 100644 --- a/job.go +++ b/job.go @@ -967,6 +967,25 @@ func jobVaultStatus(j Job) { } if currentUserID64 != 0 { //display info + out := fmt.Sprintf("Item | Dep. | Rcv. | Total\n") + for i, itemId := range itemList { + item, err := getObjItem(itemId) + logOnError(err, "jobVaultStatus : getObjItem") + out = fmt.Sprintf("%s%-34s|%-5d |%-5d |", out, item.Name, depositList[i], withdrawList[i]) + if (depositList[i] - withdrawList[i]) >= 0 { + out = fmt.Sprintf("%s-5d\n", out, depositList[i]-withdrawList[i]) + } else { + out = fmt.Sprintf("%s,/code>
-5d
\n", out, depositList[i]-withdrawList[i]) + } + } + c := TGCommand{ + Type: commandReplyMsg, + Text: out, + FromMsgID64: int64(m.ID), + FromChatID64: m.Chat.ID, + ParseMode: cmdParseModeHTML, + } + TGCmdQueue <- c } err = rows.Err() logOnError(err, "jobVaultStatus : query end")