forked from oldramen/hashtag-amy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
src.js
123 lines (110 loc) · 3.04 KB
/
src.js
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//This is where everything happens
//All of the main code will be here, and it will require
//any external files.
/*THINGS TO DO (maybe):
on REGISTER
if is bot
get roominfo
set vars for roomid, roomname
log all the users currently in the room
updateidletimes for all users in room
update current song and votes
add djs to djlist, count first song for dj
check for mods
check if bot is mod
else
check if user banned
if banned, boot, else return
log user
update idle for user
fan user
if babble is false
check if user has custom greeting
greet with custom greeting
else check if user is SU
greet with SU greeting
else check if user is VIP
greet with vip greeting
else greet with regular greeting
done
on DEREGISTER
unlog user
if in queue, delete from queue
if has status, delete status
done
on UPDATE VOTES
if songName defined
get room info
songName = song name
updateidle of user
upvotes = awesomes
downvotes = lames
on NEW SONG
if song != current song
say last song, with upvotes and downvotes
clear last song / votes - set the new ones
if song limit on
if last dj song count = maxsongs
if overmax > 0
warn dj he has reached the limit
if any other dj song count > max songs + oversongs
remove dj
subtract wait count from djs who are waiting
if waitcount = 0, delete from waitint
log current dj
add count to song count for dj
on SNAGGED
vote up
done
on NEW MOD
if is bot
log that bot is mod
else
log new mod; add to list
done
on REM MOD
if is bot
log that bot is not mod
else
remove old mod from mod list
done
on ADD DJ
updateidle of user
ger room info
if 1 dj on deck
add bot as dj
else if bot is dj && > 2 djs on deck
rem bot as dj
if queue is on && people in queue
if user is next
delete user from queue
else
rem user (?)
say not his turn, notify user who IS next of turn
done
if song limits on
if dj is waiting && not vip
remove dj, tell dj how many more songs to wait
if dj has old song count && dj'd less than cleartime ago
add old song count back
*cleartime = amount of time to reset song count
else remove old song count && song count = 0
done
on REM DJ
updateidle of user
getroominfo
if 1dj on deck && bot is that dj
rem bot as dj
else if 1dj on deck
add bot as dj
if queue enabled
if someone in queue
say next is next
if user has song count
old song count = new song count
log time of last dj
on SPEAK
updateidle of user
check for commands
if command, run command
*/