diff options
Diffstat (limited to 'src/main.lisp')
| -rw-r--r-- | src/main.lisp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/main.lisp b/src/main.lisp index 419bb67..6d83ff4 100644 --- a/src/main.lisp +++ b/src/main.lisp | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | (:nicknames :ukkoclot) | 4 | (:nicknames :ukkoclot) |
| 5 | (:use :c2cl :ukkoclot/bot :ukkoclot/config :ukkoclot/inline-bots :ukkoclot/log :ukkoclot/tg-types) | 5 | (:use :c2cl :ukkoclot/bot :ukkoclot/config :ukkoclot/inline-bots :ukkoclot/log :ukkoclot/tg-types) |
| 6 | (:import-from :anaphora :acond :awhen :it) | 6 | (:import-from :anaphora :acond :awhen :it) |
| 7 | (:import-from :ukkoclot/bot :make-bot :bot-power-on) | 7 | (:import-from :ukkoclot/bot :make-bot :bot-power-on :fixup-value) |
| 8 | (:import-from :ukkoclot/db :with-db) | 8 | (:import-from :ukkoclot/db :with-db) |
| 9 | (:import-from :ukkoclot/strings :escape-xml :is-tg-whitespace-str :starts-with :starts-with-ignore-case) | 9 | (:import-from :ukkoclot/strings :escape-xml :is-tg-whitespace-str :starts-with :starts-with-ignore-case) |
| 10 | (:local-nicknames | 10 | (:local-nicknames |
| @@ -32,7 +32,8 @@ | |||
| 32 | (log-info "We're done!"))) | 32 | (log-info "We're done!"))) |
| 33 | 33 | ||
| 34 | (defun wrapped-main (bot config) | 34 | (defun wrapped-main (bot config) |
| 35 | (send-message bot :chat-id (config-dev-group config) :text "Initializing...") | 35 | (when *in-prod* |
| 36 | (send-message bot :chat-id (config-dev-group config) :text "Initializing...")) | ||
| 36 | (set-my-name bot :name (config-bot-name config)) | 37 | (set-my-name bot :name (config-bot-name config)) |
| 37 | (let ((gup-offset 0)) | 38 | (let ((gup-offset 0)) |
| 38 | (loop while (bot-power-on bot) do | 39 | (loop while (bot-power-on bot) do |
| @@ -101,14 +102,17 @@ | |||
| 101 | (on-new-member bot msg new-chat-member))))) | 102 | (on-new-member bot msg new-chat-member))))) |
| 102 | 103 | ||
| 103 | (defun on-new-member (bot msg new-member) | 104 | (defun on-new-member (bot msg new-member) |
| 104 | ;; TODO: Rule 11 no hating on cats on bot entry | ||
| 105 | ;; TODO: Rule 10 have fun and enjoy your time on user entry | 105 | ;; TODO: Rule 10 have fun and enjoy your time on user entry |
| 106 | (if (= (user-id new-member) (bot-id bot)) | 106 | (if (= (user-id new-member) (bot-id bot)) |
| 107 | nil | 107 | (reply-animation bot msg #P"blob/rule-11.mp4" |
| 108 | (reply-message bot msg | 108 | :allow-sending-without-reply t) |
| 109 | (concatenate 'string "Hello there, " (user-format-name new-member) "! Be on your bestest behaviour now!!") | 109 | (reply-animation bot msg #P"blob/rule-10.mp4" |
| 110 | :parse-mode "HTML" | 110 | :text (concatenate 'string "Hello there, " |
| 111 | :allow-sending-without-reply t))) | 111 | (user-format-name new-member) |
| 112 | "! Be on your bestest behaviour now!!") | ||
| 113 | :parse-mode "HTML" | ||
| 114 | :caption-above t | ||
| 115 | :allow-sending-without-reply t))) | ||
| 112 | 116 | ||
| 113 | (defun is-bad-text (text) | 117 | (defun is-bad-text (text) |
| 114 | ;; TODO: | 118 | ;; TODO: |
| @@ -130,7 +134,7 @@ | |||
| 130 | 134 | ||
| 131 | (awhen (message-entities msg) | 135 | (awhen (message-entities msg) |
| 132 | (loop for entity across it | 136 | (loop for entity across it |
| 133 | when (and (eq (message-entity-type entity) :bot-command) | 137 | when (and (equal (message-entity-type entity) "bot_command") |
| 134 | (= (message-entity-offset entity) 0)) | 138 | (= (message-entity-offset entity) 0)) |
| 135 | do (on-text-command bot msg text (message-entity-extract entity text)))) | 139 | do (on-text-command bot msg text (message-entity-extract entity text)))) |
| 136 | 140 | ||
| @@ -218,9 +222,7 @@ | |||
| 218 | 222 | ||
| 219 | ((and (equal simple-cmd "msginfo") | 223 | ((and (equal simple-cmd "msginfo") |
| 220 | (message-reply-to-message msg)) | 224 | (message-reply-to-message msg)) |
| 221 | (reply-message bot it | 225 | (reply-message bot it (fixup-value it))) |
| 222 | ;; TODO: Text needs lot more massaging lol | ||
| 223 | (jzon:stringify (arg-encode it)))) | ||
| 224 | 226 | ||
| 225 | ((equal simple-cmd "ping") | 227 | ((equal simple-cmd "ping") |
| 226 | (let* ((start-time (get-internal-real-time)) | 228 | (let* ((start-time (get-internal-real-time)) |