update vault status

This commit is contained in:
shoopea 2019-10-11 15:45:53 +08:00
parent a61840949b
commit 1eb93a80a2

19
job.go
View File

@ -967,6 +967,25 @@ func jobVaultStatus(j Job) {
}
if currentUserID64 != 0 {
//display info
out := fmt.Sprintf("<code>Item | Dep. | Rcv. | Total</code>\n")
for i, itemId := range itemList {
item, err := getObjItem(itemId)
logOnError(err, "jobVaultStatus : getObjItem")
out = fmt.Sprintf("%s<code>%-34s|%-5d |%-5d |", out, item.Name, depositList[i], withdrawList[i])
if (depositList[i] - withdrawList[i]) >= 0 {
out = fmt.Sprintf("%s-5d</code>\n", out, depositList[i]-withdrawList[i])
} else {
out = fmt.Sprintf("%s,/code><pre>-5d</pre>\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")