|
|
@@ -170,16 +170,17 @@
|
|
|
(string-upcase label)))
|
|
|
|
|
|
(def-message-cmd-handler handler-rates (:rates)
|
|
|
- (when args
|
|
|
- (db/set-chat-symbols chat-id (mapcar #'get-label-symbol args)))
|
|
|
- (let ((last (db/get-last-finance (or (db/get-chat-symbols chat-id) *default-symbols*))))
|
|
|
+ (let* ((symbols (or (when args (mapcar #'get-label-symbol args))
|
|
|
+ (db/get-chat-symbols chat-id)
|
|
|
+ *default-symbols*))
|
|
|
+ (last (db/get-last-finance symbols)))
|
|
|
(bot-send-message chat-id
|
|
|
(if last
|
|
|
(format nil "~{~A *~$*~^, ~} @ _~A_"
|
|
|
(loop for (ts symbol price) in last
|
|
|
append (list (get-symbol-label symbol) price))
|
|
|
(format-ts (local-time:unix-to-timestamp (caar last))))
|
|
|
- "Пока нет данных. Если тикер реальный, проверь через минуту")
|
|
|
+ "Пока нет данных. Если тикер реальный, задай через /setrates <tickers>")
|
|
|
:parse-mode "markdown")))
|
|
|
|
|
|
(def-message-cmd-handler handler-charts (:charts)
|
|
|
@@ -203,3 +204,11 @@
|
|
|
(loop for (ts symbol price) in rates
|
|
|
append (list (get-symbol-label symbol) price))
|
|
|
(format-ts (local-time:unix-to-timestamp (caar rates)))))))
|
|
|
+
|
|
|
+(def-message-cmd-handler handler-set-rates (:setrates)
|
|
|
+ (when args
|
|
|
+ (db/set-chat-symbols chat-id (mapcar #'get-label-symbol args)))
|
|
|
+ (bot-send-message chat-id
|
|
|
+ (format nil "Пишем ~{_~a_~#[~; и ~:;, ~]~}"
|
|
|
+ (mapcar #'get-symbol-label (db/get-chat-symbols chat-id)))
|
|
|
+ :parse-mode "markdown"))
|