diff options
| author | LLLL Colonq <llll@colonq> | 2024-04-26 01:53:24 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2024-04-26 01:53:24 -0400 |
| commit | 6fa49e57f7313aad8852ce2721c2fcf7d0cec030 (patch) | |
| tree | 34a2e4a851c663bc6d71d148e59b59ba345a5fdb /src/wasp-twitch.el | |
| parent | 782c667e824d426b5443591afeefc37d0ae17785 (diff) | |
Updates
Diffstat (limited to 'src/wasp-twitch.el')
| -rw-r--r-- | src/wasp-twitch.el | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/wasp-twitch.el b/src/wasp-twitch.el index aa51d17b..61068164 100644 --- a/src/wasp-twitch.el +++ b/src/wasp-twitch.el @@ -49,6 +49,7 @@ (defvar w/twitch-emote-frame-timer nil) (defvar w/twitch-redeems nil) (defvar w/twitch-chat-commands nil) +(defvar w/twitch-gamer-counter 0) (defun w/twitch-api-get (loc k) "Get LOC from the Twitch API, passing the returned JSON to K." @@ -397,6 +398,26 @@ CALLBACK will be passed the winner when the poll concludes." w/twitch-emote-frame-timer (run-with-timer 0.03 nil #'w/twitch-run-emote-frame-timer))) +(defun w/twitch-badges-sigil (badges) + "Return the sigil character BADGES for the current user." + (let ((equity (alist-get :equity w/user-current))) + (apply + #'s-concat + (-non-nil + (list + (when (-contains? badges "broadcaster/1") "(it me)") + (when (-contains? badges "moderator/1") "β") + (when (-contains? badges "artist-badge/1") "ποΈ") + (when (and equity (> equity 0)) + (cond + ((s-equals? (s-downcase w/user-current-name) "bezelea") "βΏπ") + ((s-equals? (s-downcase w/user-current-name) "altovt") "π") + ((s-equals? (s-downcase w/user-current-name) "prodzpod") "π") + ((s-equals? (s-downcase w/user-current-name) "faeliore") "πΉ") + (t "EL."))) + (when (-contains? badges "vip/1") "π") + (when (-contains? badges "subscriber/0") "π»")))))) + (defun w/twitch-handle-incoming-chat (msg) "Write MSG to the chat buffer, processing any commands." (w/write-log (format "%s" msg)) @@ -408,7 +429,7 @@ CALLBACK will be passed the winner when the poll concludes." (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)))) + (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)) @@ -424,7 +445,8 @@ CALLBACK will be passed the winner when the poll concludes." :id userid :text text-with-emotes :user-color (when (s-present? color) color) - :biblicality (cdr biblicality))) + :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)))))))) @@ -441,7 +463,11 @@ CALLBACK will be passed the winner when the poll concludes." (w/user-bind user (lambda () - (funcall (cadr handler) user input))) + (condition-case err + (funcall (cadr handler) user input) + (error + (w/write-chat-event (format "Error during redeem: %s" err)) + )))) (w/write-log (format "Unknown channel point redeem: %S" redeem))))) (defun w/twitch-handle-redeem-api (r) |
