|
|
@@ -41,12 +41,13 @@
|
|
|
(destructuring-bind (journal . ut)
|
|
|
(or (gethash chat-id *ledger/chat-journals*)
|
|
|
(ledger/parse-uri chat-id uri))
|
|
|
- (send-response chat-id (format nil "Журнал с ~D записями, из ~A, обновлён ~A.~%Веб-хук: ~A"
|
|
|
- (length journal)
|
|
|
- (quri:render-uri (quri:make-uri :userinfo nil
|
|
|
- :defaults uri))
|
|
|
- (ledger/format-time ut)
|
|
|
- (ledger/get-hook-url chat-id uri))))
|
|
|
+ (bot-send-message chat-id (format nil "Журнал с ~D записями, из ~A, обновлён ~A.~%Веб-хук: ~A"
|
|
|
+ (length journal)
|
|
|
+ (quri:render-uri (quri:make-uri :userinfo nil
|
|
|
+ :defaults uri))
|
|
|
+ (ledger/format-time ut)
|
|
|
+ (ledger/get-hook-url chat-id uri))
|
|
|
+ :disable-web-preview t))
|
|
|
(send-response chat-id "Добавь урл журнала, /ledger <url>"))))
|
|
|
|
|
|
(def-message-cmd-handler handler-ledger (:ledger)
|
|
|
@@ -58,7 +59,7 @@
|
|
|
(destructuring-bind (journal . ut)
|
|
|
(gethash chat-id *ledger/chat-journals*)
|
|
|
(if journal
|
|
|
- (bot-send-message chat-id (format nil "```~%~A~%```~%Обновлено: ~A"
|
|
|
+ (bot-send-message chat-id (format nil "```~%~A~%```Обновлено: ~A"
|
|
|
(pta-ledger:journal-balance journal query)
|
|
|
(ledger/format-time ut))
|
|
|
:parse-mode "markdown")
|
|
|
@@ -74,15 +75,10 @@
|
|
|
(:otherwise (ledger/handle-balance chat-id (spaced args)))))
|
|
|
|
|
|
(def-webhook-handler ledger/handle-webhook ("ledger")
|
|
|
- (cond
|
|
|
- ((= 2 (length paths))
|
|
|
- (destructuring-bind (chat-id hmac) paths
|
|
|
- (let ((true-hmac (token-hmac chat-id)))
|
|
|
- (if (string= true-hmac hmac)
|
|
|
- (secret/with (uri (list :ledger chat-id))
|
|
|
- (if uri
|
|
|
- (progn (ledger/parse-uri (parse-integer chat-id) uri)
|
|
|
- "OK")
|
|
|
- "FAIL"))
|
|
|
- "FAIL"))))
|
|
|
- (:otherwise "FAIL")))
|
|
|
+ (when (= 2 (length paths))
|
|
|
+ (destructuring-bind (chat-id hmac) paths
|
|
|
+ (let ((true-hmac (token-hmac chat-id)))
|
|
|
+ (when (string= true-hmac hmac)
|
|
|
+ (secret/with (uri (list :ledger chat-id))
|
|
|
+ (when uri
|
|
|
+ (ledger/parse-uri (parse-integer chat-id) uri))))))))
|