blob: 01e68b324b20c8757b00dd7c6c6fc3ef43c02b21 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
;;; wasp-event-handlers --- Event handlers -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(require 'soundboard)
(require 'wasp-bus)
(require 'wasp-twitch)
(require 'wasp-friend)
(require 'wasp-model)
(setf
w/bus-event-handlers
(list
(cons '(monitor twitch chat incoming) #'w/twitch-handle-incoming-chat)
(cons '(monitor twitch redeem incoming) #'w/twitch-handle-redeem)
(cons
'(monitor twitch raid)
(lambda (msg)
(let ((user (car msg)))
(soundboard//play-clip "rampage.mp3")
(w/write-chat-event (format "%s just raided!" user))
(w/friend-respond (format "%s just came to visit" user))
(run-with-timer
15 nil
(lambda ()
(w/twitch-get-user-recent-clips
user
(lambda (clips)
(w/model-region-word "hair" (s-concat user "_"))
(w/model-region-word "eyes" "WELCOME")
(if clips
(w/model-region-video "hair" (car clips))
(w/model-region-user-avatar "hair" user)))))))))
(cons
'(monitor twitch follow)
(lambda (msg)
(let ((user (car msg)))
;; (soundboard//play-clip "firstblood.mp3")
;; (w/model-region-word "skin" (format "welcome_%s_" user))
(w/friend-respond (format "%s just followed the stream" user))
;; (w/write-chat-event (format "New follower: %s" user))
)
))
(cons
'(monitor twitch poll begin)
(lambda (_)
(w/write-chat-event "Poll started")
(w/friend-respond "The chatters are doing a poll")))
(cons
'(monitor twitch poll end)
(lambda (msg)
(let ((winner (car (-max-by (-on #'> #'cadr) (cadr msg)))))
(w/write-chat-event (format "Poll finished, winner is: %s" winner))
(when w/twitch-current-poll-callback
(funcall w/twitch-current-poll-callback winner))
(setq w/twitch-current-poll-callback nil))))
(cons
'(monitor twitch prediction begin)
(lambda (msg)
(w/write-chat-event "Gamble started")
(w/friend-respond "The chatters are gambling")
(setq w/twitch-current-prediction-ids msg)))
(cons
'(monitor twitch prediction end)
(lambda (_)
(w/write-chat-event "Gamble finished")
(setq w/twitch-current-prediction-ids nil)))
))
(provide 'wasp-event-handlers)
;;; wasp-event-handlers.el ends here
|