Skip to content

Commit 9039b35

Browse files
Merge pull request #1 from flowlo/feuerrotefriederike-patch-1
Update bot.clj
2 parents f2bbb96 + a1899de commit 9039b35

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/strong_signal/bot.clj

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,24 @@
1919
(defn caesar [k message] message
2020
(apply str (rotate k (seq (clojure.string/lower-case message)))))
2121

22-
(def plaintexts '("men generally believe what they want to believe"
22+
(def plaintexts '("i came i saw i conquered"
23+
"men generally believe what they want to believe"
2324
"i came i saw i conquered"
24-
"i like treason but not traitors"))
25+
"i like treason but not traitors"
26+
"experience is the teacher of all things"
27+
"no one is so brave that he is not disturbed by something unexpected"
28+
"cowards die many times before their actual deaths"
29+
"the valiant never taste of death but once"
30+
"arms and laws do not flourish together"))
2531

2632
(defn plaintext [x] (nth plaintexts (mod (atol x) (count plaintexts))))
2733

2834
(defn ciphertext [x] (caesar (mod (atol x) 13) (plaintext x)))
2935

30-
(def success-text "Well done! That makes sense. It seems that Julias Caesar, the roman empire had a similar epiphany.")
36+
(def success-texts '("Well done! That makes sense. It seems that Julius Caesar, the roman empire had a similar epiphany."
37+
"Congratulations! That's one small step for man, one giant leap for mankind."
38+
"Amazing! Seems we have a kind of an expert here."
39+
"Awesome. As Julius Caesar said: the die is cast."))
3140

3241
(def wrong-texts '("Doesn't match! Please try again!"
3342
"Sorry, that’s incorrect. Try again!"
@@ -54,7 +63,7 @@
5463
time-of-message (get-in payload [:timestamp])
5564
message-text (get-in payload [:message :text])]
5665
(cond
57-
(s/includes? (s/lower-case message-text) (plaintext sender-id)) (fb/send-message sender-id (fb/text-message success-text))
66+
(s/includes? (s/lower-case message-text) (plaintext sender-id)) (fb/send-message sender-id (fb/text-message (rand-nth success-texts)))
5867
:else (fb/send-message sender-id (rand-wrong)))))
5968

6069
(defn on-postback [payload]
@@ -76,4 +85,4 @@
7685
recipient-id (get-in payload [:recipient :id])
7786
time-of-message (get-in payload [:timestamp])
7887
attachments (get-in payload [:message :attachments])]
79-
(fb/send-message sender-id (fb/text-message "Thanks for your attachments :)"))))
88+
(fb/send-message sender-id (fb/text-message (rand-nth '("Thanks, looks nice. :)" "Thanks, i like!"))))))

0 commit comments

Comments
 (0)