qwtf_discord_bot 5.4.0 → 5.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/VERSION +1 -1
- data/lib/pug.rb +5 -3
- data/lib/qwtf_discord_bot/qwtf_discord_bot_pug.rb +133 -114
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55e755d887d064bcf3067b5360e2b2c30d0f88f6fffd0c3e43f7255ff392ee4f
|
4
|
+
data.tar.gz: 3efe1df2e2ecf4ba8e1af9099e5969e36d77c08d56e5422a21cef7332573ddf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8509a4b5ea6b5c57fcf987524673b2b3f89488104e0680575b9e948ef4253d00aaeac67c02bdc29c7857bd9908dc253de8843a87e4ffb882fa61f6bdeaf23442
|
7
|
+
data.tar.gz: a4452e760d59de5175d52e90f7940653d1f5a595ed01f4b4e0a8249e3a5f07a929c1806d84e851f93c5b5e546a7906782b365b5f062c1e9bf9f2806641340335
|
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.4.
|
1
|
+
5.4.5
|
data/lib/pug.rb
CHANGED
@@ -122,13 +122,15 @@ class Pug
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def teams
|
125
|
-
teams_keys.inject({}) do |teams, team|
|
126
|
-
teams.merge({ team.split(':').last => redis.smembers(team).map(&:to_i) })
|
125
|
+
all_teams = teams_keys.inject({}) do |teams, team|
|
126
|
+
teams.merge({ team.split(':').last.to_i => redis.smembers(team).map(&:to_i) })
|
127
127
|
end
|
128
|
+
|
129
|
+
all_teams.sort.to_h
|
128
130
|
end
|
129
131
|
|
130
132
|
def actual_teams
|
131
|
-
teams.tap { |team| team.delete(
|
133
|
+
teams.tap { |team| team.delete(0) }
|
132
134
|
end
|
133
135
|
|
134
136
|
private
|
@@ -7,54 +7,93 @@ class QwtfDiscordBotPug # :nodoc:
|
|
7
7
|
include QwtfDiscordBot
|
8
8
|
|
9
9
|
MSG_SNIPPET_DELIMITER = ' · '
|
10
|
+
TEAM_NAMES = { 0 => "No team", 1 => "Blue", 2 => "Red" }
|
10
11
|
|
11
12
|
def run
|
12
13
|
bot = Discordrb::Commands::CommandBot.new(
|
13
14
|
token: QwtfDiscordBot.config.token,
|
14
15
|
client_id: QwtfDiscordBot.config.client_id,
|
15
16
|
help_command: false,
|
16
|
-
prefix:
|
17
|
+
prefix: proc do |message|
|
18
|
+
match = /^\!(\w+)(.*)/.match(message.content)
|
19
|
+
if match
|
20
|
+
first = match[1]
|
21
|
+
rest = match[2]
|
22
|
+
# Return the modified string with the first word lowercase:
|
23
|
+
"#{first.downcase}#{rest}"
|
24
|
+
end
|
25
|
+
end
|
17
26
|
)
|
18
27
|
|
19
28
|
bot.command :help do |event, *args|
|
20
|
-
"Pug commands: `!status`, `!join`, `!team <team_no>`, `!unteam`, `!leave`, `!kick <@player>`, `!win <team_no>`, `!draw`, `!end`, `!teamsize <no_of_players>`, `!addmap <map_name>`, `!removemap <map_name>`, `!maps`, `!map <map_name>`, `!notify <@role>`"
|
29
|
+
"Pug commands: `!status`, `!join`, `!team <team_no>`, `!unteam`, `!leave`, `!kick <@player>`, `!win <team_no>`, `!draw`, `!end`, `!teamsize <no_of_players>`, `!addmap <map_name>`, `!removemap <map_name>`, `!maps`, `!map <map_name>`, `!choose`, `!notify <@role>`"
|
21
30
|
end
|
22
31
|
|
23
32
|
bot.command :join do |event, *args|
|
24
33
|
setup_pug(event) do |e, pug|
|
25
|
-
return
|
34
|
+
return send_embedded_message("You've already joined", e.channel) if pug.joined?(e.user_id)
|
26
35
|
|
27
36
|
join_pug(e, pug)
|
28
37
|
start_pug(pug, e) if pug.full?
|
29
38
|
end
|
30
39
|
end
|
31
40
|
|
41
|
+
bot.command :choose do |event, *args|
|
42
|
+
setup_pug(event) do |e, pug|
|
43
|
+
return send_embedded_message("Can't choose teams until PUG is full", e.channel) unless pug.full?
|
44
|
+
|
45
|
+
pug.joined_players.each do |player_id|
|
46
|
+
pug.join_team(team_no: 0, player_id: player_id)
|
47
|
+
end
|
48
|
+
|
49
|
+
start_pug(pug, e)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
32
53
|
bot.command :status do |event, *args|
|
33
54
|
setup_pug(event) do |e, pug|
|
34
|
-
return
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
55
|
+
return send_embedded_message('No PUG has been started. `!join` to create', e.channel) unless pug.active?
|
56
|
+
|
57
|
+
footer = [
|
58
|
+
pug.game_map,
|
59
|
+
"#{pug.player_slots} joined",
|
60
|
+
].compact.join(MSG_SNIPPET_DELIMITER)
|
61
|
+
|
62
|
+
send_embedded_message(nil, e.channel) do |embed|
|
63
|
+
embed.footer = Discordrb::Webhooks::EmbedFooter.new(
|
64
|
+
text: footer
|
65
|
+
)
|
66
|
+
|
67
|
+
pug.teams.each do |team_no, player_ids|
|
68
|
+
team_display_names = player_ids.map do |player_id|
|
69
|
+
e.display_name_for(player_id)
|
70
|
+
end
|
71
|
+
|
72
|
+
embed.add_field(
|
73
|
+
Discordrb::Webhooks::EmbedField.new(
|
74
|
+
{
|
75
|
+
inline: true,
|
76
|
+
name: team_name(team_no),
|
77
|
+
value: team_display_names.join("\n")
|
78
|
+
}
|
79
|
+
)
|
80
|
+
)
|
81
|
+
end
|
82
|
+
end
|
44
83
|
end
|
45
84
|
end
|
46
85
|
|
47
86
|
bot.command :teamsize do |event, *args|
|
48
87
|
setup_pug(event) do |e, pug|
|
49
|
-
return
|
88
|
+
return send_embedded_message("Team size is #{pug.teamsize}", e.channel) unless args.any?
|
50
89
|
|
51
90
|
new_teamsize = args[0].to_i
|
52
|
-
return
|
91
|
+
return send_embedded_message('Team size should be a number higher than 0', e.channel) unless new_teamsize > 0
|
53
92
|
|
54
93
|
if new_teamsize
|
55
94
|
pug.teamsize = new_teamsize
|
56
95
|
|
57
|
-
|
96
|
+
send_embedded_message(
|
58
97
|
[
|
59
98
|
"Team size set to #{pug.teamsize}",
|
60
99
|
"#{pug.player_slots} joined"
|
@@ -64,7 +103,7 @@ class QwtfDiscordBotPug # :nodoc:
|
|
64
103
|
|
65
104
|
start_pug(pug, e) if pug.full?
|
66
105
|
else
|
67
|
-
|
106
|
+
send_embedded_message(
|
68
107
|
[
|
69
108
|
"Current team size is #{pug.teamsize}",
|
70
109
|
"#{pug.player_slots} joined"
|
@@ -77,8 +116,8 @@ class QwtfDiscordBotPug # :nodoc:
|
|
77
116
|
|
78
117
|
bot.command :leave do |event, *args|
|
79
118
|
setup_pug(event) do |e, pug|
|
80
|
-
return
|
81
|
-
return
|
119
|
+
return send_embedded_message(no_active_pug_message, e.channel) unless pug.active?
|
120
|
+
return send_embedded_message("You're not in the PUG", e.channel) unless pug.joined?(e.user_id)
|
82
121
|
|
83
122
|
pug.leave(e.user_id)
|
84
123
|
|
@@ -89,7 +128,7 @@ class QwtfDiscordBotPug # :nodoc:
|
|
89
128
|
|
90
129
|
snippets << "#{pug.slots_left} more #{pug.notify_roles}" if pug.slots_left == 1
|
91
130
|
|
92
|
-
|
131
|
+
send_embedded_message(
|
93
132
|
snippets.join(MSG_SNIPPET_DELIMITER),
|
94
133
|
e.channel
|
95
134
|
)
|
@@ -100,12 +139,12 @@ class QwtfDiscordBotPug # :nodoc:
|
|
100
139
|
|
101
140
|
bot.command :kick do |event, *args|
|
102
141
|
setup_pug(event) do |e, pug|
|
103
|
-
return
|
104
|
-
return
|
142
|
+
return send_embedded_message("Kick who? e.g. `!kick @#{e.display_name}`", e.channel) unless args.any?
|
143
|
+
return send_embedded_message(no_active_pug_message, e.channel) unless pug.active?
|
105
144
|
|
106
145
|
args.each do |arg|
|
107
146
|
unless arg.match(/<@!\d+>/)
|
108
|
-
|
147
|
+
send_embedded_message("#{arg} isn't a valid mention", e.channel)
|
109
148
|
next
|
110
149
|
end
|
111
150
|
|
@@ -113,7 +152,7 @@ class QwtfDiscordBotPug # :nodoc:
|
|
113
152
|
display_name = e.display_name_for(user_id) || arg
|
114
153
|
|
115
154
|
unless pug.joined?(user_id)
|
116
|
-
|
155
|
+
send_embedded_message("#{display_name} isn't in the PUG", e.channel)
|
117
156
|
next
|
118
157
|
end
|
119
158
|
|
@@ -126,7 +165,7 @@ class QwtfDiscordBotPug # :nodoc:
|
|
126
165
|
|
127
166
|
snippets << "#{pug.slots_left} more #{pug.notify_roles}" if pug.slots_left == 1
|
128
167
|
|
129
|
-
|
168
|
+
send_embedded_message(
|
130
169
|
snippets.join(MSG_SNIPPET_DELIMITER),
|
131
170
|
e.channel
|
132
171
|
)
|
@@ -138,30 +177,29 @@ class QwtfDiscordBotPug # :nodoc:
|
|
138
177
|
|
139
178
|
bot.command :team do |event, *args|
|
140
179
|
setup_pug(event) do |e, pug|
|
141
|
-
return
|
142
|
-
|
143
|
-
team_no = args[0].to_i
|
144
|
-
return send_msg("Choose a team between 0 and 4", e.channel) unless team_no.between?(0, 4)
|
180
|
+
return send_embedded_message("Which team? E.G. `!team 1`", e.channel) unless args.any?
|
181
|
+
return send_embedded_message("Choose a team between 0 and 2", e.channel) unless ["0", "1", "2"].any?(args.first)
|
145
182
|
|
183
|
+
team_no = args.first.to_i
|
146
184
|
pug_already_full = pug.full?
|
147
185
|
|
148
186
|
if args.count == 1
|
149
187
|
user_id = e.user_id
|
150
|
-
return
|
188
|
+
return send_embedded_message("You're already in #{TEAM_NAMES[team_no]}", e.channel) if pug.team(team_no).include?(user_id)
|
151
189
|
|
152
190
|
join_pug(e, pug) unless pug.joined?(user_id)
|
153
191
|
pug.join_team(team_no: team_no, player_id: user_id)
|
154
192
|
|
155
|
-
|
193
|
+
send_embedded_message(
|
156
194
|
[
|
157
|
-
"#{e.display_name} joins
|
195
|
+
"#{e.display_name} joins #{TEAM_NAMES[team_no]}",
|
158
196
|
"#{pug.team_player_count(team_no)}/#{pug.teamsize}"
|
159
197
|
].join(MSG_SNIPPET_DELIMITER), e.channel
|
160
198
|
)
|
161
199
|
else
|
162
200
|
args[1..-1].each do |mention|
|
163
201
|
unless mention.match(/<@!\d+>/)
|
164
|
-
|
202
|
+
send_embedded_message("#{arg} isn't a valid mention", e.channel)
|
165
203
|
next
|
166
204
|
end
|
167
205
|
|
@@ -169,15 +207,15 @@ class QwtfDiscordBotPug # :nodoc:
|
|
169
207
|
display_name = e.display_name_for(user_id) || arg
|
170
208
|
|
171
209
|
unless pug.joined?(user_id)
|
172
|
-
|
210
|
+
send_embedded_message("#{display_name} isn't in the PUG", e.channel)
|
173
211
|
next
|
174
212
|
end
|
175
213
|
|
176
214
|
pug.join_team(team_no: team_no, player_id: user_id)
|
177
215
|
|
178
|
-
|
216
|
+
send_embedded_message(
|
179
217
|
[
|
180
|
-
"#{display_name} joins
|
218
|
+
"#{display_name} joins #{TEAM_NAMES[team_no]}",
|
181
219
|
"#{pug.team_player_count(team_no)}/#{pug.teamsize}"
|
182
220
|
].join(MSG_SNIPPET_DELIMITER), e.channel
|
183
221
|
)
|
@@ -191,25 +229,25 @@ class QwtfDiscordBotPug # :nodoc:
|
|
191
229
|
bot.command :unteam do |event, *args|
|
192
230
|
setup_pug(event) do |e, pug|
|
193
231
|
user_id = e.user_id
|
194
|
-
return
|
195
|
-
return
|
196
|
-
return
|
232
|
+
return send_embedded_message('No PUG has been started. `!join` to create', e.channel) unless pug.active?
|
233
|
+
return send_embedded_message("You aren't in this PUG", e.channel) unless pug.joined?(user_id)
|
234
|
+
return send_embedded_message("You aren't in a team", e.channel) if pug.team(0).include?(user_id)
|
197
235
|
|
198
236
|
pug.join_team(team_no: 0, player_id: user_id)
|
199
|
-
|
237
|
+
send_embedded_message("#{e.display_name} has no team", e.channel)
|
200
238
|
end
|
201
239
|
end
|
202
240
|
|
203
241
|
bot.command :win do |event, *args|
|
204
242
|
setup_pug(event) do |e, pug|
|
205
|
-
return
|
243
|
+
return send_embedded_message(no_active_pug_message, e.channel) unless pug.active?
|
244
|
+
return send_embedded_message("Specify winning team; e.g. `!win 1`", e.channel) unless args.any?
|
245
|
+
return send_embedded_message("Invalid team number", e.channel) unless ["1", "2"].any?(args.first)
|
206
246
|
|
207
|
-
winning_team_no = args
|
208
|
-
|
209
|
-
return send_msg("Not a valid team", e.channel) unless pug.team(winning_team_no).any?
|
247
|
+
winning_team_no = args.first.to_i
|
210
248
|
|
211
249
|
if pug.actual_teams.count < 2
|
212
|
-
return
|
250
|
+
return send_embedded_message(
|
213
251
|
"There must be at least two teams with players to submit a result", e.channel
|
214
252
|
)
|
215
253
|
end
|
@@ -236,26 +274,16 @@ class QwtfDiscordBotPug # :nodoc:
|
|
236
274
|
}.to_json
|
237
275
|
)
|
238
276
|
|
239
|
-
#
|
240
|
-
# e.display_name_for(player_id)
|
241
|
-
# end
|
242
|
-
|
243
|
-
# non_winning_teams = pug.actual_teams.tap { |team| team.delete(winning_team_no) }
|
244
|
-
|
245
|
-
# losing_players = non_winning_teams.values.flatten.map do |player_id|
|
246
|
-
# e.display_name_for(player_id)
|
247
|
-
# end
|
248
|
-
|
249
|
-
send_msg("Team #{winning_team_no} wins", e.channel)
|
277
|
+
send_embedded_message("#{TEAM_NAMES[winning_team_no]} wins. [Ratings](http://ratings.fortressone.org)", e.channel)
|
250
278
|
end
|
251
279
|
end
|
252
280
|
|
253
281
|
bot.command :draw do |event, *args|
|
254
282
|
setup_pug(event) do |e, pug|
|
255
|
-
return
|
283
|
+
return send_embedded_message(no_active_pug_message, e.channel) unless pug.active?
|
256
284
|
|
257
285
|
if pug.actual_teams.count < 2
|
258
|
-
return
|
286
|
+
return send_embedded_message(
|
259
287
|
"There must be at least two teams with players to submit a result", e.channel
|
260
288
|
)
|
261
289
|
end
|
@@ -281,13 +309,13 @@ class QwtfDiscordBotPug # :nodoc:
|
|
281
309
|
}.to_json
|
282
310
|
)
|
283
311
|
|
284
|
-
|
312
|
+
send_embedded_message("Match drawn. [Ratings](http://ratings.fortressone.org)", e.channel)
|
285
313
|
end
|
286
314
|
end
|
287
315
|
|
288
316
|
bot.command :end do |event, *args|
|
289
317
|
setup_pug(event) do |e, pug|
|
290
|
-
return
|
318
|
+
return send_embedded_message(no_active_pug_message, e.channel) unless pug.active?
|
291
319
|
|
292
320
|
end_pug(pug, e.channel)
|
293
321
|
end
|
@@ -296,47 +324,47 @@ class QwtfDiscordBotPug # :nodoc:
|
|
296
324
|
bot.command :addmap do |event, *args|
|
297
325
|
setup_pug(event) do |e, pug|
|
298
326
|
maps = args
|
299
|
-
return
|
327
|
+
return send_embedded_message("What map? e.g. `!addmap 2fort5r`", e.channel) unless maps.any?
|
300
328
|
|
301
329
|
pug.add_maps(maps)
|
302
|
-
|
330
|
+
send_embedded_message("#{maps.join(', ')} added to maps", e.channel)
|
303
331
|
end
|
304
332
|
end
|
305
333
|
|
306
334
|
bot.command :removemap do |event, *args|
|
307
335
|
setup_pug(event) do |e, pug|
|
308
336
|
maps = args
|
309
|
-
return
|
337
|
+
return send_embedded_message("What map? e.g. `!removemap 2fort5r`", e.channel) unless maps.any?
|
310
338
|
|
311
339
|
pug.remove_maps(maps)
|
312
|
-
|
340
|
+
send_embedded_message("#{maps.join(', ')} removed from maps", e.channel)
|
313
341
|
end
|
314
342
|
end
|
315
343
|
|
316
344
|
bot.command :maps do |event, *args|
|
317
345
|
setup_pug(event) do |e, pug|
|
318
346
|
maps = pug.maps
|
319
|
-
return
|
347
|
+
return send_embedded_message('No maps have been added. `!addmap`', e.channel) unless maps.any?
|
320
348
|
|
321
|
-
|
349
|
+
send_embedded_message(maps.join(', '), e.channel)
|
322
350
|
end
|
323
351
|
end
|
324
352
|
|
325
353
|
bot.command :map do |event, *args|
|
326
354
|
setup_pug(event) do |e, pug|
|
327
355
|
maps = pug.maps
|
328
|
-
return
|
329
|
-
return
|
356
|
+
return send_embedded_message('No maps have been added. `!addmap`', e.channel) unless maps.any?
|
357
|
+
return send_embedded_message(no_active_pug_message, e.channel) unless pug.active?
|
330
358
|
|
331
359
|
if args.empty?
|
332
|
-
return
|
333
|
-
|
360
|
+
return send_embedded_message('No map has been set for the current PUG', e.channel) unless pug.game_map
|
361
|
+
send_embedded_message("Current map is #{pug.game_map}", e.channel)
|
334
362
|
else
|
335
363
|
game_map = args.first
|
336
|
-
return
|
364
|
+
return send_embedded_message("#{game_map} isn't in the map list. `!addmap` to add it.", e.channel) unless maps.include?(game_map)
|
337
365
|
|
338
366
|
pug.game_map = game_map
|
339
|
-
|
367
|
+
send_embedded_message("Map set to #{game_map}", e.channel)
|
340
368
|
end
|
341
369
|
end
|
342
370
|
end
|
@@ -352,7 +380,7 @@ class QwtfDiscordBotPug # :nodoc:
|
|
352
380
|
"Notification role set to #{roles}"
|
353
381
|
end
|
354
382
|
|
355
|
-
|
383
|
+
send_embedded_message(msg, e.channel)
|
356
384
|
end
|
357
385
|
end
|
358
386
|
|
@@ -361,6 +389,10 @@ class QwtfDiscordBotPug # :nodoc:
|
|
361
389
|
|
362
390
|
private
|
363
391
|
|
392
|
+
def team_name(team_no)
|
393
|
+
[team_no, TEAM_NAMES[team_no]].join(" ")
|
394
|
+
end
|
395
|
+
|
364
396
|
def mention_to_user_id(mention)
|
365
397
|
mention[3..-2].to_i
|
366
398
|
end
|
@@ -375,7 +407,7 @@ class QwtfDiscordBotPug # :nodoc:
|
|
375
407
|
snippets << "#{pug.slots_left} more #{pug.notify_roles}" if pug.slots_left.between?(1, 3)
|
376
408
|
end
|
377
409
|
|
378
|
-
|
410
|
+
send_embedded_message(snippets.join(MSG_SNIPPET_DELIMITER), e.channel)
|
379
411
|
end
|
380
412
|
|
381
413
|
def setup_pug(event)
|
@@ -387,6 +419,7 @@ class QwtfDiscordBotPug # :nodoc:
|
|
387
419
|
|
388
420
|
def start_pug(pug, event)
|
389
421
|
if !pug.actual_teams.any?
|
422
|
+
send_embedded_message("Choosing fair teams...", event.channel)
|
390
423
|
teams = get_fair_teams(pug.joined_players)
|
391
424
|
|
392
425
|
teams.each do |team_no, player_ids|
|
@@ -396,62 +429,48 @@ class QwtfDiscordBotPug # :nodoc:
|
|
396
429
|
end
|
397
430
|
end
|
398
431
|
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
432
|
+
footer = [
|
433
|
+
pug.game_map,
|
434
|
+
"#{pug.player_slots} joined",
|
435
|
+
].compact.join(MSG_SNIPPET_DELIMITER)
|
403
436
|
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
teamsize: pug.teamsize
|
437
|
+
send_embedded_message("Time to play!", event.channel) do |embed|
|
438
|
+
embed.footer = Discordrb::Webhooks::EmbedFooter.new(
|
439
|
+
text: footer
|
408
440
|
)
|
409
|
-
end
|
410
441
|
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
send_msg(msg, event.channel)
|
417
|
-
end
|
442
|
+
pug.teams.each do |team_no, player_ids|
|
443
|
+
team_mentions = player_ids.map do |player_id|
|
444
|
+
event.mention_for(player_id)
|
445
|
+
end
|
418
446
|
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
447
|
+
embed.add_field(
|
448
|
+
Discordrb::Webhooks::EmbedField.new(
|
449
|
+
{
|
450
|
+
inline: true,
|
451
|
+
name: team_name(team_no),
|
452
|
+
value: team_mentions.join("\n")
|
453
|
+
}
|
454
|
+
)
|
455
|
+
)
|
423
456
|
end
|
424
|
-
|
425
|
-
team_status_line(
|
426
|
-
team_no: team_no.to_i,
|
427
|
-
names: team_display_names,
|
428
|
-
teamsize: pug.teamsize
|
429
|
-
)
|
430
|
-
end
|
431
|
-
end
|
432
|
-
|
433
|
-
def team_status_line(team_no:, names:, teamsize:)
|
434
|
-
if team_no.to_i.zero?
|
435
|
-
["No team: #{names.join(', ')}"]
|
436
|
-
else
|
437
|
-
[
|
438
|
-
"Team #{team_no}: #{names.join(', ')}",
|
439
|
-
"#{names.count}/#{teamsize}"
|
440
|
-
].join(MSG_SNIPPET_DELIMITER)
|
441
457
|
end
|
442
458
|
end
|
443
459
|
|
444
460
|
def end_pug(pug, channel_id)
|
445
461
|
pug.end_pug
|
446
|
-
|
462
|
+
send_embedded_message('PUG ended', channel_id)
|
447
463
|
end
|
448
464
|
|
449
465
|
def no_active_pug_message
|
450
466
|
"There's no active PUG"
|
451
467
|
end
|
452
468
|
|
453
|
-
def
|
454
|
-
|
469
|
+
def send_embedded_message(message, channel)
|
470
|
+
embed = Discordrb::Webhooks::Embed.new
|
471
|
+
embed.description = message
|
472
|
+
yield(embed) if block_given?
|
473
|
+
channel.send_embed(nil, embed) && puts(message)
|
455
474
|
end
|
456
475
|
|
457
476
|
def post_results(json)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qwtf_discord_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.4.
|
4
|
+
version: 5.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sheldon Johnson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: discordrb
|