Innokentiy Enikeev hace 5 años
padre
commit
ddee7f5a67
Se han modificado 3 ficheros con 13 adiciones y 10 borrados
  1. 2 2
      plugins/forecast.lisp
  2. 1 1
      plugins/huiza.lisp
  3. 10 7
      plugins/q3a.lisp

+ 2 - 2
plugins/forecast.lisp

@@ -90,7 +90,7 @@
                         (forecast
                          (aget "latitude" location)
                          (aget "longitude" location)
-                         :hourly (find "hourly" (cons (string cmd) args) :key #'string-downcase :test #'equal)
-                         :daily (find "daily" (cons (string cmd) args) :key #'string-downcase :test #'equal)))
+                         :hourly (find "hourly" (cons (string *cmd*) *args*) :key #'string-downcase :test #'equal)
+                         :daily (find "daily" (cons (string *cmd*) *args*) :key #'string-downcase :test #'equal)))
                        "Так а ты чьих будешь?")))
     (bot-send-message response)))

+ 1 - 1
plugins/huiza.lisp

@@ -54,5 +54,5 @@
 
 (def-message-handler huiza-handler (-1000)
   (log:info "handle-unknown-message" *message*)
-  (send-dont-understand (preprocess-input text))
+  (send-dont-understand (preprocess-input *text*))
   t)

+ 10 - 7
plugins/q3a.lisp

@@ -14,8 +14,9 @@
     (loop
        with last-pos = (file-position s)
        for line = (read-line s nil nil)
-       when line do (progn
-                      (funcall thunk line)
+       when line do (unwind-protect
+                         (handler-case (funcall thunk line)
+                           (error (e) (log:error e)))
                       (setf last-pos (file-position s)))
        else do (progn
                  (sleep 0.1)
@@ -50,10 +51,11 @@
      when (suicidep player kill) sum -1 else sum 1))
 
 (defun get-rankings (&optional (game *game*))
-  (sort (loop for player across (game-players game)
-           when (player-began player)
-           collect (cons (player-score player) player))
-        #'> :key #'car))
+  (when-let (players (game-players game))
+    (sort (loop for player across players
+             when (player-began player)
+             collect (cons (player-score player) player))
+          #'> :key #'car)))
 
 (defun game-status (&optional (game *game*))
   (let ((ranks (get-rankings)))
@@ -104,7 +106,8 @@
            (action (keyify (subseq line 7 sep)))
            (args (when (and sep (> (length line) (+ 2 sep))) (subseq line (+ 2 sep))))
            (client (when args (parse-integer args :junk-allowed t)))
-           (player (when (and client (<= 0 client (1- (max-players)))) (elt (game-players *game*) client))))
+           (player (when (and client (<= 0 client (1- (max-players))))
+             (elt (game-players *game*) client))))
       (setf (game-last-time *game*) (trim-nil time))
       (case action
         (:initgame (with-slots (info players is-active) *game*