]> NullRing Git Server - nullerbot.git/commitdiff
abstractions for different cities main
authorPreston Pan <ret2pop@nullring.xyz>
Tue, 17 Feb 2026 22:30:04 +0000 (14:30 -0800)
committerAndrei <andreisva2023@gmail.com>
Wed, 18 Feb 2026 01:58:00 +0000 (17:58 -0800)
Signed-off-by: Andrei <andreisva2023@gmail.com>
src/main.lisp

index d789921a48573576093e3f2dc7412af1dd6fab5e..fb74901f4b979d0068133b641f93105aee0d2ec8 100644 (file)
 (defparameter +feed-room-id+ "!ShuXi5ohrPUtKHkrNO:matrix.nullring.xyz")
 (defparameter +feed-cache-path+ #P"./nullbot_cache.sexp")
 (defparameter +feed-sleep-minutes+ 1)
 (defparameter +feed-room-id+ "!ShuXi5ohrPUtKHkrNO:matrix.nullring.xyz")
 (defparameter +feed-cache-path+ #P"./nullbot_cache.sexp")
 (defparameter +feed-sleep-minutes+ 1)
+(defparameter +weather-vancouver+ )
 
 (defparameter +prefix+ "$")
 
 
 (defparameter +prefix+ "$")
 
-(defun get-temp
-    (&aux
-       (endpoint "https://api.weather.gc.ca/collections/swob-realtime/items?f=json&lang=en&url=CYVR&sortby=-date_tm-value&limit=1&properties=date_tm-value,air_temp,air_temp-uom,air_temp-qa")
+(defun get-temp (weather-station
+    &aux
+       (endpoint (format nil "https://api.weather.gc.ca/collections/swob-realtime/items?f=json&lang=en&url=C~A&sortby=-date_tm-value&limit=1&properties=date_tm-value,air_temp,air_temp-uom,air_temp-qa" weather-station))
        (data (jzon:parse (dex:get endpoint))))
   (hash-get (aref (gethash "features" data) 0) '("properties" "air_temp")))
 
        (data (jzon:parse (dex:get endpoint))))
   (hash-get (aref (gethash "features" data) 0) '("properties" "air_temp")))
 
@@ -41,7 +42,7 @@
       ((string= command "$help")
        (mapi:sendmsg *bot* room-id "Unlike some other bots, I'm nice :3"))
       ((string= command "$weather")
       ((string= command "$help")
        (mapi:sendmsg *bot* room-id "Unlike some other bots, I'm nice :3"))
       ((string= command "$weather")
-       (mapi:sendmsg *bot* room-id (format nil "It's ~a degrees in Vancouver" (get-temp)))))))
+       (mapi:sendmsg *bot* room-id (format nil "It's ~a degrees in Vancouver~%It's ~a degrees in Victoria" (get-temp "YVR") (get-temp "YYJ")))))))
 
 (defmethod mapi:on-event
     ((obj nullbot) event room-id
 
 (defmethod mapi:on-event
     ((obj nullbot) event room-id