From 5d003af92aff89cc600c1125e2e8767fc88b7ae4 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Thu, 8 May 2025 04:31:17 -0400 Subject: The latest and greatest updates that you crave, now --- assets/avatars/thelinuxdeveloper.png | Bin 0 -> 7654 bytes assets/emotes/305253899 | Bin 0 -> 1356 bytes assets/emotes/743892 | Bin 0 -> 3581 bytes .../emotesv2_05169161f5a94af39ec596028c1db21d | Bin 0 -> 2736 bytes .../emotesv2_0554d02dacff41e581b5afeab4c0a7ca | Bin 0 -> 7592 bytes .../emotesv2_06bfc6b158144849a4eef12a00556b67 | Bin 0 -> 2792 bytes .../emotesv2_1089a8ae44254372b1575327ff30812f | Bin 0 -> 2552 bytes .../emotesv2_1faf6c1e1020451d90fda9bcb0a99f3c | Bin 0 -> 21587 bytes .../emotesv2_217e1e34ea2046fe8c0bbde5caf5f0c8 | Bin 0 -> 8961 bytes .../emotesv2_227b6a85ff56478d8d28837fcde03ac4 | Bin 0 -> 7290 bytes .../emotesv2_261bfa0359934a178c35d253e4b4de21 | Bin 0 -> 1495 bytes .../emotesv2_4b06d5f5321b489faf37ae38babd5064 | Bin 0 -> 46176 bytes .../emotesv2_4c0f316564f54d219c9bda42272cdaca | Bin 0 -> 2778 bytes .../emotesv2_874ef23b8d294ba49bc2402daee9efbe | Bin 0 -> 2163 bytes .../emotesv2_97ef546130b747258790859cf26388c0 | Bin 0 -> 2384 bytes .../emotesv2_9961a2709cab4334ab49eb15a2b4803e | Bin 0 -> 7813 bytes .../emotesv2_9b6ef9bc0c644c599dc986eeb251dd83 | Bin 0 -> 9365 bytes .../emotesv2_9d9299fadae44c52abfedef321027585 | Bin 0 -> 2288 bytes .../emotesv2_9f757dc6a7414bbabe304e3e29b55407 | Bin 0 -> 2819 bytes .../emotesv2_badab775ebbc4c129cb5927d63262490 | Bin 0 -> 12272 bytes .../emotesv2_bf37df4a50254659a1b92f0f60a8b2e8 | Bin 0 -> 9108 bytes .../emotesv2_c5012a17cc9c4b6487c71e4b30676d10 | Bin 0 -> 32871 bytes .../emotesv2_e00f86eef5614559bde9c67dc1a66237 | Bin 0 -> 6687 bytes .../emotesv2_e2b5c0a5d9434281ac7990c06381121e | Bin 0 -> 690 bytes .../emotesv2_eac39b2603744cbbb82662e0cf23a241 | Bin 0 -> 1841 bytes .../emotesv2_fedc29d7866f4e15b00cfed3e15cccd8 | Bin 0 -> 2665 bytes .../emotesv2_ffe411bce9c44a9886ab7d2d6c51a2b4 | Bin 0 -> 1968 bytes assets/glossary/2025-05-06.txt | 1 + src/wasp-bus-binary.el | 144 +++++++++++++++++++++ src/wasp-event-handlers-binary.el | 24 ++++ src/wasp-event-handlers.el | 2 +- src/wasp-twitch.el | 102 +++++++-------- src/wasp-user-whitelist.el | 2 + 33 files changed, 223 insertions(+), 52 deletions(-) create mode 100644 assets/avatars/thelinuxdeveloper.png create mode 100644 assets/emotes/305253899 create mode 100644 assets/emotes/743892 create mode 100644 assets/emotes/emotesv2_05169161f5a94af39ec596028c1db21d create mode 100644 assets/emotes/emotesv2_0554d02dacff41e581b5afeab4c0a7ca create mode 100644 assets/emotes/emotesv2_06bfc6b158144849a4eef12a00556b67 create mode 100644 assets/emotes/emotesv2_1089a8ae44254372b1575327ff30812f create mode 100644 assets/emotes/emotesv2_1faf6c1e1020451d90fda9bcb0a99f3c create mode 100644 assets/emotes/emotesv2_217e1e34ea2046fe8c0bbde5caf5f0c8 create mode 100644 assets/emotes/emotesv2_227b6a85ff56478d8d28837fcde03ac4 create mode 100644 assets/emotes/emotesv2_261bfa0359934a178c35d253e4b4de21 create mode 100644 assets/emotes/emotesv2_4b06d5f5321b489faf37ae38babd5064 create mode 100644 assets/emotes/emotesv2_4c0f316564f54d219c9bda42272cdaca create mode 100644 assets/emotes/emotesv2_874ef23b8d294ba49bc2402daee9efbe create mode 100644 assets/emotes/emotesv2_97ef546130b747258790859cf26388c0 create mode 100644 assets/emotes/emotesv2_9961a2709cab4334ab49eb15a2b4803e create mode 100644 assets/emotes/emotesv2_9b6ef9bc0c644c599dc986eeb251dd83 create mode 100644 assets/emotes/emotesv2_9d9299fadae44c52abfedef321027585 create mode 100644 assets/emotes/emotesv2_9f757dc6a7414bbabe304e3e29b55407 create mode 100644 assets/emotes/emotesv2_badab775ebbc4c129cb5927d63262490 create mode 100644 assets/emotes/emotesv2_bf37df4a50254659a1b92f0f60a8b2e8 create mode 100644 assets/emotes/emotesv2_c5012a17cc9c4b6487c71e4b30676d10 create mode 100644 assets/emotes/emotesv2_e00f86eef5614559bde9c67dc1a66237 create mode 100644 assets/emotes/emotesv2_e2b5c0a5d9434281ac7990c06381121e create mode 100644 assets/emotes/emotesv2_eac39b2603744cbbb82662e0cf23a241 create mode 100644 assets/emotes/emotesv2_fedc29d7866f4e15b00cfed3e15cccd8 create mode 100644 assets/emotes/emotesv2_ffe411bce9c44a9886ab7d2d6c51a2b4 create mode 100644 assets/glossary/2025-05-06.txt create mode 100644 src/wasp-bus-binary.el create mode 100644 src/wasp-event-handlers-binary.el diff --git a/assets/avatars/thelinuxdeveloper.png b/assets/avatars/thelinuxdeveloper.png new file mode 100644 index 00000000..39a934f0 Binary files /dev/null and b/assets/avatars/thelinuxdeveloper.png differ diff --git a/assets/emotes/305253899 b/assets/emotes/305253899 new file mode 100644 index 00000000..9874c22e Binary files /dev/null and b/assets/emotes/305253899 differ diff --git a/assets/emotes/743892 b/assets/emotes/743892 new file mode 100644 index 00000000..5c43dd71 Binary files /dev/null and b/assets/emotes/743892 differ diff --git a/assets/emotes/emotesv2_05169161f5a94af39ec596028c1db21d b/assets/emotes/emotesv2_05169161f5a94af39ec596028c1db21d new file mode 100644 index 00000000..43013eee Binary files /dev/null and b/assets/emotes/emotesv2_05169161f5a94af39ec596028c1db21d differ diff --git a/assets/emotes/emotesv2_0554d02dacff41e581b5afeab4c0a7ca b/assets/emotes/emotesv2_0554d02dacff41e581b5afeab4c0a7ca new file mode 100644 index 00000000..468b772b Binary files /dev/null and b/assets/emotes/emotesv2_0554d02dacff41e581b5afeab4c0a7ca differ diff --git a/assets/emotes/emotesv2_06bfc6b158144849a4eef12a00556b67 b/assets/emotes/emotesv2_06bfc6b158144849a4eef12a00556b67 new file mode 100644 index 00000000..3ecb20a9 Binary files /dev/null and b/assets/emotes/emotesv2_06bfc6b158144849a4eef12a00556b67 differ diff --git a/assets/emotes/emotesv2_1089a8ae44254372b1575327ff30812f b/assets/emotes/emotesv2_1089a8ae44254372b1575327ff30812f new file mode 100644 index 00000000..a1201b31 Binary files /dev/null and b/assets/emotes/emotesv2_1089a8ae44254372b1575327ff30812f differ diff --git a/assets/emotes/emotesv2_1faf6c1e1020451d90fda9bcb0a99f3c b/assets/emotes/emotesv2_1faf6c1e1020451d90fda9bcb0a99f3c new file mode 100644 index 00000000..bbd4d086 Binary files /dev/null and b/assets/emotes/emotesv2_1faf6c1e1020451d90fda9bcb0a99f3c differ diff --git a/assets/emotes/emotesv2_217e1e34ea2046fe8c0bbde5caf5f0c8 b/assets/emotes/emotesv2_217e1e34ea2046fe8c0bbde5caf5f0c8 new file mode 100644 index 00000000..4b019b9b Binary files /dev/null and b/assets/emotes/emotesv2_217e1e34ea2046fe8c0bbde5caf5f0c8 differ diff --git a/assets/emotes/emotesv2_227b6a85ff56478d8d28837fcde03ac4 b/assets/emotes/emotesv2_227b6a85ff56478d8d28837fcde03ac4 new file mode 100644 index 00000000..7a9ff768 Binary files /dev/null and b/assets/emotes/emotesv2_227b6a85ff56478d8d28837fcde03ac4 differ diff --git a/assets/emotes/emotesv2_261bfa0359934a178c35d253e4b4de21 b/assets/emotes/emotesv2_261bfa0359934a178c35d253e4b4de21 new file mode 100644 index 00000000..870bfd54 Binary files /dev/null and b/assets/emotes/emotesv2_261bfa0359934a178c35d253e4b4de21 differ diff --git a/assets/emotes/emotesv2_4b06d5f5321b489faf37ae38babd5064 b/assets/emotes/emotesv2_4b06d5f5321b489faf37ae38babd5064 new file mode 100644 index 00000000..a9f8e6e3 Binary files /dev/null and b/assets/emotes/emotesv2_4b06d5f5321b489faf37ae38babd5064 differ diff --git a/assets/emotes/emotesv2_4c0f316564f54d219c9bda42272cdaca b/assets/emotes/emotesv2_4c0f316564f54d219c9bda42272cdaca new file mode 100644 index 00000000..ad477d6a Binary files /dev/null and b/assets/emotes/emotesv2_4c0f316564f54d219c9bda42272cdaca differ diff --git a/assets/emotes/emotesv2_874ef23b8d294ba49bc2402daee9efbe b/assets/emotes/emotesv2_874ef23b8d294ba49bc2402daee9efbe new file mode 100644 index 00000000..7fa94842 Binary files /dev/null and b/assets/emotes/emotesv2_874ef23b8d294ba49bc2402daee9efbe differ diff --git a/assets/emotes/emotesv2_97ef546130b747258790859cf26388c0 b/assets/emotes/emotesv2_97ef546130b747258790859cf26388c0 new file mode 100644 index 00000000..70897c61 Binary files /dev/null and b/assets/emotes/emotesv2_97ef546130b747258790859cf26388c0 differ diff --git a/assets/emotes/emotesv2_9961a2709cab4334ab49eb15a2b4803e b/assets/emotes/emotesv2_9961a2709cab4334ab49eb15a2b4803e new file mode 100644 index 00000000..ad9ccea7 Binary files /dev/null and b/assets/emotes/emotesv2_9961a2709cab4334ab49eb15a2b4803e differ diff --git a/assets/emotes/emotesv2_9b6ef9bc0c644c599dc986eeb251dd83 b/assets/emotes/emotesv2_9b6ef9bc0c644c599dc986eeb251dd83 new file mode 100644 index 00000000..818f29e0 Binary files /dev/null and b/assets/emotes/emotesv2_9b6ef9bc0c644c599dc986eeb251dd83 differ diff --git a/assets/emotes/emotesv2_9d9299fadae44c52abfedef321027585 b/assets/emotes/emotesv2_9d9299fadae44c52abfedef321027585 new file mode 100644 index 00000000..822177b3 Binary files /dev/null and b/assets/emotes/emotesv2_9d9299fadae44c52abfedef321027585 differ diff --git a/assets/emotes/emotesv2_9f757dc6a7414bbabe304e3e29b55407 b/assets/emotes/emotesv2_9f757dc6a7414bbabe304e3e29b55407 new file mode 100644 index 00000000..4112c047 Binary files /dev/null and b/assets/emotes/emotesv2_9f757dc6a7414bbabe304e3e29b55407 differ diff --git a/assets/emotes/emotesv2_badab775ebbc4c129cb5927d63262490 b/assets/emotes/emotesv2_badab775ebbc4c129cb5927d63262490 new file mode 100644 index 00000000..69f36d99 Binary files /dev/null and b/assets/emotes/emotesv2_badab775ebbc4c129cb5927d63262490 differ diff --git a/assets/emotes/emotesv2_bf37df4a50254659a1b92f0f60a8b2e8 b/assets/emotes/emotesv2_bf37df4a50254659a1b92f0f60a8b2e8 new file mode 100644 index 00000000..86bb6239 Binary files /dev/null and b/assets/emotes/emotesv2_bf37df4a50254659a1b92f0f60a8b2e8 differ diff --git a/assets/emotes/emotesv2_c5012a17cc9c4b6487c71e4b30676d10 b/assets/emotes/emotesv2_c5012a17cc9c4b6487c71e4b30676d10 new file mode 100644 index 00000000..dd179f95 Binary files /dev/null and b/assets/emotes/emotesv2_c5012a17cc9c4b6487c71e4b30676d10 differ diff --git a/assets/emotes/emotesv2_e00f86eef5614559bde9c67dc1a66237 b/assets/emotes/emotesv2_e00f86eef5614559bde9c67dc1a66237 new file mode 100644 index 00000000..0ed53c2b Binary files /dev/null and b/assets/emotes/emotesv2_e00f86eef5614559bde9c67dc1a66237 differ diff --git a/assets/emotes/emotesv2_e2b5c0a5d9434281ac7990c06381121e b/assets/emotes/emotesv2_e2b5c0a5d9434281ac7990c06381121e new file mode 100644 index 00000000..8fac151c Binary files /dev/null and b/assets/emotes/emotesv2_e2b5c0a5d9434281ac7990c06381121e differ diff --git a/assets/emotes/emotesv2_eac39b2603744cbbb82662e0cf23a241 b/assets/emotes/emotesv2_eac39b2603744cbbb82662e0cf23a241 new file mode 100644 index 00000000..7b25ce46 Binary files /dev/null and b/assets/emotes/emotesv2_eac39b2603744cbbb82662e0cf23a241 differ diff --git a/assets/emotes/emotesv2_fedc29d7866f4e15b00cfed3e15cccd8 b/assets/emotes/emotesv2_fedc29d7866f4e15b00cfed3e15cccd8 new file mode 100644 index 00000000..1ca447c7 Binary files /dev/null and b/assets/emotes/emotesv2_fedc29d7866f4e15b00cfed3e15cccd8 differ diff --git a/assets/emotes/emotesv2_ffe411bce9c44a9886ab7d2d6c51a2b4 b/assets/emotes/emotesv2_ffe411bce9c44a9886ab7d2d6c51a2b4 new file mode 100644 index 00000000..e4a4abbf Binary files /dev/null and b/assets/emotes/emotesv2_ffe411bce9c44a9886ab7d2d6c51a2b4 differ diff --git a/assets/glossary/2025-05-06.txt b/assets/glossary/2025-05-06.txt new file mode 100644 index 00000000..47f23cc0 --- /dev/null +++ b/assets/glossary/2025-05-06.txt @@ -0,0 +1 @@ +there was a guest appearance by a clonkhead, discussions about emacs debugging, and we continued making progress on the gba system while testing some new features. \ No newline at end of file diff --git a/src/wasp-bus-binary.el b/src/wasp-bus-binary.el new file mode 100644 index 00000000..bb9fc6da --- /dev/null +++ b/src/wasp-bus-binary.el @@ -0,0 +1,144 @@ +;;; wasp-bus-binary --- Pub/sub bus client -*- lexical-binding: t; -*- +;;; Commentary: +;;; Code: + +(require 'dash) +(require 's) +(require 'wasp-utils) + +(defcustom w/bus-binary-process "wasp-bus-binary" + "Name of process connected to binary message bus." + :type '(string) + :group 'wasp) + +(defcustom w/bus-binary-buffer " *wasp-bus-binary*" + "Name of buffer used to store intermediate binary message bus data." + :type '(string) + :group 'wasp) + +(defcustom w/bus-binary-host "shiro" + "Hostname of the binary message bus." + :type '(string) + :group 'wasp) + +(defcustom w/bus-binary-port 32051 + "Port of the binary message bus." + :type '(integer) + :group 'wasp) + +(defvar w/bus-binary-event-handlers nil + "List of pairs of events and handler functions.") + +(defun w/bus-binary-read-bytes (len) + "Read LEN bytes from the current buffer. +Advances point by LEN also." + (let ((end (+ (point) len))) + (when (<= end (point-max)) + (let ((istr (buffer-substring (point) end))) + (forward-char len) + istr)))) + +(defun w/bus-binary-read-int32le () + "Read a 32-bit little endian integer from the current buffer." + (when-let* ((istr (w/bus-binary-read-bytes 4))) + (-let [(x0 x1 x2 x3) (seq-into istr 'list)] + (logior x0 (ash x1 8) (ash x2 16) (ash x3 24))))) + +(defun w/bus-binary-read-length-prefixed () + "Read a length-prefixed string from the current buffer. +Return nil if unable." + (let ((start (point))) + (if-let* ((len (w/bus-binary-read-int32le))) + (progn + (w/bus-binary-read-bytes len)) + (goto-char start) + nil))) + +(defun w/bus-binary-read-message () + "Parse a message from the current buffer. +Return non-nil if a message was successfully parsed." + (if-let* ( (start (point)) + (ev (w/bus-binary-read-length-prefixed)) + (d (w/bus-binary-read-length-prefixed))) + (progn + (delete-region start (point)) + (cons ev d)) + (goto-char start) + nil)) + +(defun w/bus-binary-handle-message () + "Parse and handle a message from the current buffer. +Return non-nil if a message was successfully parsed." + (when-let* ((msg (w/bus-binary-read-message))) + (-let [(ev . d) msg] + (print (cons ev d)) + (when-let* ((handler (w/saget ev w/bus-binary-event-handlers))) + (funcall handler d)) + t))) + +(defun w/bus-binary-process-filter (proc data) + "Process filter for binary message bus connection on PROC and DATA." + (with-current-buffer (get-buffer-create w/bus-binary-buffer) + (set-buffer-multibyte nil) + (when (not (marker-position (process-mark proc))) + (set-marker (process-mark proc) (point-max))) + (goto-char (process-mark proc)) + (insert data) + (set-marker (process-mark proc) (point)) + (goto-char (point-min)) + (while (w/bus-binary-handle-message)))) + +(defun w/bus-binary-build-int32le (x) + "Convert X into the bytes for a little endian 32-bit integer." + (unibyte-string + (logand x #xff) + (logand (lsh x -8) #xff) + (logand (lsh x -16) #xff) + (logand (lsh x -24) #xff))) + +(defun w/bus-binary-build-length-prefixed (s) + "Turn S into a length-prefixed unibyte string." + (s-concat + (w/bus-binary-build-int32le (string-bytes s)) + s)) + +(defun w/bus-binary-convert-event (ev) + "Convert the s-expression EV to a string event." + (s-chop-suffix ")" (s-chop-prefix "(" (format "%s" ev)))) + +(defun w/binary-sub (ev) + "Subscribe to the event EV." + (process-send-string + w/bus-binary-process + (s-concat "s" + (w/bus-binary-build-length-prefixed (w/bus-binary-convert-event ev))))) + +(defun w/binary-pub (ev &optional d) + "Publish the data D to the event EV." + (process-send-string + w/bus-binary-process + (s-concat "p" + (w/bus-binary-build-length-prefixed (w/bus-binary-convert-event ev)) + (w/bus-binary-build-length-prefixed (or d ""))))) + +(defun w/bus-binary-disconnect () + "Disconnect from Redis." + (when (process-live-p (get-process w/bus-binary-process)) + (delete-process w/bus-binary-process))) + +(defun w/bus-binary-connect () + "Connect to Redis." + (w/bus-binary-disconnect) + (with-current-buffer (get-buffer-create w/bus-binary-buffer) + (set-buffer-multibyte nil) + (erase-buffer)) + (make-network-process + :coding 'no-conversion + :name w/bus-binary-process + :buffer nil + :host w/bus-binary-host + :service w/bus-binary-port + :filter #'w/bus-binary-process-filter)) + +(provide 'wasp-bus-binary) +;;; wasp-bus-binary.el ends here diff --git a/src/wasp-event-handlers-binary.el b/src/wasp-event-handlers-binary.el new file mode 100644 index 00000000..ae373b8c --- /dev/null +++ b/src/wasp-event-handlers-binary.el @@ -0,0 +1,24 @@ +;;; wasp-event-handlers-binary --- Event handlers -*- lexical-binding: t; -*- +;;; Commentary: +;;; Code: + +(require 'dash) +(require 's) +(require 'wasp-utils) +(require 'wasp-twitch) +(require 'wasp-bus-binary) + +(setf + w/bus-binary-event-handlers + (list + (cons "monitor twitch chat incoming" + (lambda (d) + (-let [(user stags msg) (s-split-up-to " " d 2)] + (w/twitch-handle-incoming-chat + user + (--map (s-split "\t" it) (s-split "\n" stags)) + msg))))) + )) + +(provide 'wasp-event-handlers-binary) +;;; wasp-event-handlers-binary.el ends here diff --git a/src/wasp-event-handlers.el b/src/wasp-event-handlers.el index 0e5b8d46..d45debaf 100644 --- a/src/wasp-event-handlers.el +++ b/src/wasp-event-handlers.el @@ -39,7 +39,7 @@ ((s-equals? (car msg) "won") (w/write-chat-event "Fufufu... I win...")) (t (w/write-chat-event "that it's over"))) (setf w/overlay-barrage-active nil))) - (cons '(monitor twitch chat incoming) #'w/twitch-handle-incoming-chat) + (cons '(monitor twitch chat incoming) #'w/twitch-handle-incoming-chat-sexp) (cons '(monitor twitch redeem incoming) #'w/twitch-handle-redeem) (cons '(frontend redeem incoming) diff --git a/src/wasp-twitch.el b/src/wasp-twitch.el index 2ff66567..252ea8c2 100644 --- a/src/wasp-twitch.el +++ b/src/wasp-twitch.el @@ -538,48 +538,48 @@ CALLBACK will be passed the winner when the poll concludes." (when (-contains? badges "subscriber/0") "💻") (when (-contains? badges "founder/0") "🖥️")))))) -(defun w/twitch-handle-incoming-chat (msg) - "Write MSG to the chat buffer, processing any commands." - ;; (w/write-log (format "%s" msg)) - (let ((user (w/decode-string (car msg)))) - (w/user-bind - user - (lambda () - (let* ((tags (cadr msg)) - (userid (car (w/saget "user-id" tags))) +(defun w/twitch-handle-incoming-chat (user tags text) + "Write the message TEXT from USER with TAGS to the chat buffer. +Process any commands included." + (w/user-bind + user + (lambda () + (let* ( (userid (car (w/saget "user-id" tags))) (color (car (w/saget "color" tags))) (emotes (car (w/saget "emotes" tags))) (badges (s-split "," (car (w/saget "badges" tags)))) - (text (w/decode-string (caddr msg))) (biblicality (w/bible-colorize-sentence text)) (text-colored-bible (car biblicality)) (text-with-emotes - (w/twitch-add-7tv-emotes - (w/twitch-process-emote-ranges - (s-split "/" emotes) - text-colored-bible)))) - (push (cons user text) w/twitch-chat-history) - - (w/user-stats-update) - (w/hexamedia-update-user user) - (w/shindaggers-update-user user) - (w/copfish-update-user user) - (when (s-equals? (s-downcase user) "modclonk") - (w/obs-activate-toggle 'modclonk)) - (w/resolve-record-user user) - (w/hex-tick user) - (w/hex-transform + (w/twitch-add-7tv-emotes + (w/twitch-process-emote-ranges + (s-split "/" emotes) + text-colored-bible)))) + (push (cons user text) w/twitch-chat-history) + (w/user-stats-update) + (w/hexamedia-update-user user) + (w/shindaggers-update-user user) + (w/copfish-update-user user) + (when (s-equals? (s-downcase user) "modclonk") + (w/obs-activate-toggle 'modclonk)) + (w/resolve-record-user user) + (w/hex-tick user) + (w/hex-transform user (w/make-chat-message - :user user - :id userid - :text text-with-emotes - :user-color (when (s-present? color) color) - :biblicality (cdr biblicality) - :sigil (w/twitch-badges-sigil badges))) - (--each w/twitch-chat-commands - (when (s-contains? (car it) text) - (funcall (cdr it) user text)))))))) + :user user + :id userid + :text text-with-emotes + :user-color (when (s-present? color) color) + :biblicality (cdr biblicality) + :sigil (w/twitch-badges-sigil badges))) + (--each w/twitch-chat-commands + (when (s-contains? (car it) text) + (funcall (cdr it) user text))))))) + +(defun w/twitch-handle-incoming-chat-sexp (msg) + "Write MSG to the chat buffer, processing any commands." + (w/twitch-handle-incoming-chat (w/decode-string (car msg)) (cadr msg) (w/decode-string (caddr msg)))) (defun w/twitch-handle-redeem-helper (user redeem input &optional limit) "Handle the channel point redeem REDEEM from USER with INPUT. @@ -587,35 +587,35 @@ Optionally, only apply redeems with point costs less than LIMIT." (unless (-contains? w/user-hell (s-downcase user)) (let ((handler (alist-get redeem w/twitch-redeems nil nil #'cl-equalp))) (if handler - (if (or (not limit) (< (car handler) limit)) - (w/user-bind - user - (lambda () - (condition-case err - (funcall (cadr handler) user input) - (error - (w/write-chat-event (format "Error during redeem: %s" err)))))) - (w/write-chat-event (format "User %s attempted to activate overly expensive redeem \"%s\" via API" user redeem))) + (if (or (not limit) (< (car handler) limit)) + (w/user-bind + user + (lambda () + (condition-case err + (funcall (cadr handler) user input) + (error + (w/write-chat-event (format "Error during redeem: %s" err)))))) + (w/write-chat-event (format "User %s attempted to activate overly expensive redeem \"%s\" via API" user redeem))) (w/write-chat-event (format "Unknown channel point redeem: %S" redeem)))))) (defun w/twitch-handle-redeem (r) "Handle the channel point redeem R." ;; (w/write-log r) (let* ((user (car r)) - (redeem (cadr r)) - (encoded-input (caddr r)) - (input (when encoded-input (w/decode-string encoded-input)))) + (redeem (cadr r)) + (encoded-input (caddr r)) + (input (when encoded-input (w/decode-string encoded-input)))) (w/twitch-handle-redeem-helper user redeem input))) (defun w/twitch-handle-redeem-api (r) "Handle a channel point redeem R coming from the API." (w/write-log r) (let* ((encoded-user (car r)) - (encoded-redeem (cadr r)) - (encoded-input (caddr r)) - (user (when encoded-user (w/decode-string encoded-user))) - (redeem (when encoded-redeem (w/decode-string encoded-redeem))) - (input (when encoded-input (w/decode-string encoded-input)))) + (encoded-redeem (cadr r)) + (encoded-input (caddr r)) + (user (when encoded-user (w/decode-string encoded-user))) + (redeem (when encoded-redeem (w/decode-string encoded-redeem))) + (input (when encoded-input (w/decode-string encoded-input)))) (w/twitch-handle-redeem-helper user redeem input 1000))) (provide 'wasp-twitch) diff --git a/src/wasp-user-whitelist.el b/src/wasp-user-whitelist.el index f23471d6..5f298b3d 100644 --- a/src/wasp-user-whitelist.el +++ b/src/wasp-user-whitelist.el @@ -240,6 +240,8 @@ "taske666" "rat_not_like_noah" "RealNaesten" + "Wh4i3" + "kamszee" ))) (setq -- cgit v1.2.3