qwtf_discord_bot 5.1.2 → 5.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/qwtf_discord_bot/qwtf_discord_bot_pug.rb +40 -35
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea5f5046690139982d6f1d8324c4b4d312d6d21f5c5d6f3734211038454db8b7
|
4
|
+
data.tar.gz: 9ce6466357c99b25415f55b0eed27edd3acd8bc4e741045bfcb3cc85cbb34509
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19428a1ac12bb6da56fbebaf8e47420f49514aa579b208c8063832d41d5a8948a3dc112358a8e4c8f5ab2fa4693c6521cc89ecddf4087a02e60bcc8862c47fc9
|
7
|
+
data.tar.gz: 22d259fa928093d9eec63eb1896b1e9ec7edf32e4ef8fe5e198d3b4a882c670641e9690755ed15fea49fcee9328b2999406d8a4cc9f7d8fb719c7c34ced5bfcd
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.1.
|
1
|
+
5.1.3
|
@@ -17,44 +17,49 @@ class QwtfDiscordBotPug # :nodoc:
|
|
17
17
|
)
|
18
18
|
|
19
19
|
bot.command :join do |event, *args|
|
20
|
-
set_pug(event
|
21
|
-
pug.
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
20
|
+
set_pug(event) do |e, pug|
|
21
|
+
if pug.joined_players.include?(e.user_id)
|
22
|
+
message = "You've already joined"
|
23
|
+
send_and_log_message(message, e.channel)
|
24
|
+
else
|
25
|
+
pug.join(e.user_id)
|
26
|
+
|
27
|
+
message = if pug.joined_player_count == 1
|
28
|
+
[
|
29
|
+
"#{e.username} creates a PUG",
|
30
|
+
pug.player_slots,
|
31
|
+
pug.notify_roles
|
32
|
+
].join(' | ')
|
33
|
+
elsif pug.slots_left.between?(1,3)
|
34
|
+
[
|
35
|
+
"#{e.username} joins the PUG",
|
36
|
+
pug.player_slots,
|
37
|
+
"#{pug.slots_left} more",
|
38
|
+
pug.notify_roles
|
39
|
+
].join(' | ')
|
40
|
+
else
|
41
|
+
[
|
42
|
+
"#{e.username} joins the PUG",
|
43
|
+
pug.player_slots
|
44
|
+
].join(' | ')
|
45
|
+
end
|
42
46
|
|
43
|
-
|
47
|
+
send_and_log_message(message, e.channel)
|
44
48
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
49
|
+
if pug.full?
|
50
|
+
message = start_pug(
|
51
|
+
pug.player_slots,
|
52
|
+
e.mentions_for(pug.joined_players)
|
53
|
+
)
|
50
54
|
|
51
|
-
|
55
|
+
send_and_log_message(message, e.channel)
|
56
|
+
end
|
52
57
|
end
|
53
58
|
end
|
54
59
|
end
|
55
60
|
|
56
61
|
bot.command :status do |event, *args|
|
57
|
-
set_pug(event
|
62
|
+
set_pug(event) do |e, pug|
|
58
63
|
message = if pug.active?
|
59
64
|
[
|
60
65
|
"#{e.usernames_for(pug.joined_players).join(', ')} joined",
|
@@ -69,7 +74,7 @@ class QwtfDiscordBotPug # :nodoc:
|
|
69
74
|
end
|
70
75
|
|
71
76
|
bot.command :maxplayers do |event, *args|
|
72
|
-
set_pug(event
|
77
|
+
set_pug(event) do |e, pug|
|
73
78
|
new_maxplayers = args[0]
|
74
79
|
|
75
80
|
message = if new_maxplayers
|
@@ -93,7 +98,7 @@ class QwtfDiscordBotPug # :nodoc:
|
|
93
98
|
end
|
94
99
|
|
95
100
|
bot.command :leave do |event, *args|
|
96
|
-
set_pug(event
|
101
|
+
set_pug(event) do |e, pug|
|
97
102
|
if !pug.active?
|
98
103
|
message = "There's no active PUG to leave"
|
99
104
|
send_and_log_message(message, e.channel)
|
@@ -114,7 +119,7 @@ class QwtfDiscordBotPug # :nodoc:
|
|
114
119
|
end
|
115
120
|
|
116
121
|
bot.command :end do |event, *args|
|
117
|
-
set_pug(event
|
122
|
+
set_pug(event) do |e, pug|
|
118
123
|
message = if !pug.active?
|
119
124
|
"There's no active PUG to end"
|
120
125
|
else
|
@@ -126,7 +131,7 @@ class QwtfDiscordBotPug # :nodoc:
|
|
126
131
|
end
|
127
132
|
|
128
133
|
bot.command :notify do |event, *args|
|
129
|
-
set_pug(event
|
134
|
+
set_pug(event) do |e, pug|
|
130
135
|
roles = args.join(' ')
|
131
136
|
pug.notify_roles = roles
|
132
137
|
|
@@ -145,7 +150,7 @@ class QwtfDiscordBotPug # :nodoc:
|
|
145
150
|
|
146
151
|
private
|
147
152
|
|
148
|
-
def set_pug(event
|
153
|
+
def set_pug(event)
|
149
154
|
e = EventDecorator.new(event)
|
150
155
|
pug = Pug.for(e.channel_id)
|
151
156
|
yield(e, pug)
|