qwtf_discord_bot 5.3.7 → 5.4.0
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 +21 -0
- 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: 483a4220fb3dd783224fad769534ecb77812428dfb75dd070ce5a2299d50a6c0
|
4
|
+
data.tar.gz: 7fb143e346b0afa23f0af56d1282309d560855c41d302016514e434f01839445
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75f5981bfa1c28dea2d79011de86ac2bf5610ae7791e147b85fb1f1819d2a332098b06695d689944d400880ac8d54469f2a153508310613d5a1ea1125b790d6e
|
7
|
+
data.tar.gz: def0724c06d819f0ffcdf49f2447562c261d48b0d2875c091df9b4f47500af28411b9aa62e62f924d1a57f1f71d3345b8634ba65d8935f64a5ca591335f60383
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.
|
1
|
+
5.4.0
|
@@ -386,6 +386,16 @@ class QwtfDiscordBotPug # :nodoc:
|
|
386
386
|
end
|
387
387
|
|
388
388
|
def start_pug(pug, event)
|
389
|
+
if !pug.actual_teams.any?
|
390
|
+
teams = get_fair_teams(pug.joined_players)
|
391
|
+
|
392
|
+
teams.each do |team_no, player_ids|
|
393
|
+
player_ids.each do |player_id|
|
394
|
+
pug.join_team(team_no: team_no, player_id: player_id)
|
395
|
+
end
|
396
|
+
end
|
397
|
+
end
|
398
|
+
|
389
399
|
pug_teams = pug.teams.map do |team_no, player_ids|
|
390
400
|
team_mentions = player_ids.map do |player_id|
|
391
401
|
event.mention_for(player_id)
|
@@ -452,4 +462,15 @@ class QwtfDiscordBotPug # :nodoc:
|
|
452
462
|
http.request(req)
|
453
463
|
end
|
454
464
|
end
|
465
|
+
|
466
|
+
def get_fair_teams(players)
|
467
|
+
uri = URI("#{ENV['RATINGS_API_URL']}fair_teams/new")
|
468
|
+
params = { 'players[]' => players }
|
469
|
+
uri.query = URI.encode_www_form(params)
|
470
|
+
req = Net::HTTP::Get.new(uri)
|
471
|
+
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
472
|
+
http.request(req)
|
473
|
+
end
|
474
|
+
JSON.parse(res.body).first.to_h
|
475
|
+
end
|
455
476
|
end
|
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
|
+
version: 5.4.0
|
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-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: discordrb
|