|
@@ -80,6 +80,8 @@
|
|
|
(:lastrss (handle-cmd-last-rss chat-id id args))
|
|
(:lastrss (handle-cmd-last-rss chat-id id args))
|
|
|
(:wall (handle-cmd-wall chat-id id args))
|
|
(:wall (handle-cmd-wall chat-id id args))
|
|
|
(:nalunch (handle-cmd-nalunch chat-id id args))
|
|
(:nalunch (handle-cmd-nalunch chat-id id args))
|
|
|
|
|
+ (:g (handle-cmd-google chat-id id args))
|
|
|
|
|
+ (:г (handle-cmd-google chat-id id args))
|
|
|
(otherwise (handle-admin-cmd from-id chat-id text cmd args))))
|
|
(otherwise (handle-admin-cmd from-id chat-id text cmd args))))
|
|
|
(send-dont-understand chat-id (preprocess-input text))))
|
|
(send-dont-understand chat-id (preprocess-input text))))
|
|
|
(when location
|
|
(when location
|
|
@@ -588,6 +590,20 @@
|
|
|
(setf *nalunch-last-result* result)))
|
|
(setf *nalunch-last-result* result)))
|
|
|
(error (e) (log:error "~A" e))))
|
|
(error (e) (log:error "~A" e))))
|
|
|
|
|
|
|
|
|
|
+(defun handle-cmd-google (chat-id message-id args)
|
|
|
|
|
+ (log:info "handle-cmd-google" chat-id message-id args)
|
|
|
|
|
+ (handler-case
|
|
|
|
|
+ (telegram-send-message chat-id
|
|
|
|
|
+ (google-format-search-results
|
|
|
|
|
+ (subseq
|
|
|
|
|
+ (google-search (format nil "~{~A~^ ~}" args))
|
|
|
|
|
+ 0 3))
|
|
|
|
|
+ :parse-mode "markdown"
|
|
|
|
|
+ :disable-web-preview 1)
|
|
|
|
|
+ (error (e)
|
|
|
|
|
+ (log:error "~A" e)
|
|
|
|
|
+ (telegram-send-message chat-id (format nil "~A" e)))))
|
|
|
|
|
+
|
|
|
(defun process-watchdog ()
|
|
(defun process-watchdog ()
|
|
|
(ignore-errors
|
|
(ignore-errors
|
|
|
(close
|
|
(close
|