Skip to content

Commit

Permalink
Merge pull request #25 from tmolnar0831/development-2.0
Browse files Browse the repository at this point in the history
Fixing the newline error and adding region to weather answer 2.0.2
  • Loading branch information
tmolnar0831 committed Jan 28, 2019
2 parents bbbd79f + e3f6d44 commit cdca597
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion photter.asd
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
(asdf:defsystem "photter"
:description "Photter IRC BOT"
:author "Tamas Molnar"
:version "2.0.1"
:version "2.0.2"
:license "MIT"
:depends-on ("cl-irc"
"cl-ppcre"
"split-sequence"
"drakma"
"cl-json"
Expand Down
9 changes: 5 additions & 4 deletions photter.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

(in-package :photter)

(defparameter *version* "2.0.1")
(defparameter *version* "2.0.2")
(defvar *nick* "photter-dev")
(defvar *server* "irc.freenode.net")
(defvar *channel* "#iron-bottest-room")
Expand All @@ -22,9 +22,10 @@

(defun answer (answer source destination)
"General function for sending messages"
(if (string-equal destination *nick*)
(irc:privmsg *connection* source (princ-to-string answer))
(irc:privmsg *connection* destination (princ-to-string answer))))
(let ((text (cl-ppcre:regex-replace-all "(\\n)" answer " ")))
(if (string-equal destination *nick*)
(irc:privmsg *connection* source text)
(irc:privmsg *connection* destination text))))

(defun process-message-params (message)
(split-sequence:split-sequence #\Space (first message)))
Expand Down
3 changes: 2 additions & 1 deletion weather-checker.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@

(defun formatted-weather-data (data)
"Return a formatted answer string"
(format nil "~A, ~A, ~A, ~A°C, feels like ~A°C, wind ~Akph ~A, precipitation ~Amm, humidity ~A%, UV ~A"
(format nil "~A, ~A, ~A, ~A, ~A°C, feels like ~A°C, wind ~Akph ~A, precipitation ~Amm, humidity ~A%, UV ~A"
(aget (aget data :location) :name)
(aget (aget data :location) :region)
(aget (aget data :location) :country)
(aget (aget (aget data :current) :condition) :text)
(aget (aget data :current) :temp--c)
Expand Down

0 comments on commit cdca597

Please sign in to comment.