Эх сурвалжийг харах

[ledger] update info on balance

Innocenty Enikeew 8 жил өмнө
parent
commit
11f97b25ef
1 өөрчлөгдсөн 5 нэмэгдсэн , 3 устгасан
  1. 5 3
      plugins/ledger.lisp

+ 5 - 3
plugins/ledger.lisp

@@ -1,6 +1,7 @@
 (in-package #:chatikbot)
 (ql:quickload :pta-ledger)
 
+(defsetting *ledger/default-timezone* -3 "Default timezone for time display. GMT+3")
 (defvar *ledger/chat-journals* (make-hash-table))
 
 (defun ledger/get-hook-url (chat-id url)
@@ -32,7 +33,7 @@
 (defun ledger/format-time (universal-time)
   (when universal-time
     (multiple-value-bind (sec min hour day month year dow dst-p tz)
-        (decode-universal-time universal-time)
+        (decode-universal-time universal-time *ledger/default-timezone*)
       (declare (ignore dow dst-p tz))
       (format nil "~4,'0D-~2,'0D-~2,'0D ~2,'0D:~2,'0D:~2,'0D"
               year month day hour min sec))))
@@ -58,9 +59,10 @@
 (defun ledger/handle-balance (chat-id query)
   (destructuring-bind (journal . ut)
       (gethash chat-id *ledger/chat-journals*)
-    (declare (ignore ut))
     (if journal
-        (bot-send-message chat-id (format nil "```~%~A~%```" (pta-ledger:journal-balance journal query))
+        (bot-send-message chat-id (format nil "```~%~A~%```~%Обновлено: ~A"
+                                          (pta-ledger:journal-balance journal query)
+                                          (ledger/format-time ut))
                           :parse-mode "markdown")
         (secret/with (uri (list :ledger chat-id))
           (if uri