qwtf_discord_bot 5.5.26 → 6.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c6d6a935efeff277da0a093cc9cbbca7dd76e33a8d4d8f0bf73664d32f7b766
4
- data.tar.gz: c0ab537abc9fbe1c3f133e0eedf076348cbd5d1bad622bcc6e2cbc7a233421f2
3
+ metadata.gz: 7873dfbc7828ca1970851e98c563be1adfc62cb0f451a4a3f76d5dbc551db8a4
4
+ data.tar.gz: b34b2f5138fff279ff9ed28f2034058cef15ba3cd95c4c4157d1588dd0664dc3
5
5
  SHA512:
6
- metadata.gz: ba9d17f6b5b3f5a69e97594135cf1b87463cabcaf55e18dbf1e72e89d6f01d2594f9281042f4fdd0d3f43e3c58c822167094d74c2dfbea87c11f08df67d20702
7
- data.tar.gz: a12523817d0bb96dbffbcc2e038a862615412117b53dee96486085836be04ea70a1a3f42fe28e8d1f4a451bd60633d3f416670ab52b43ab0927c5328411cd919
6
+ metadata.gz: 6bc88b6b480c2a53a8f79a17a1c7202d446d8a068aa1daf0bc9a685ca63c09705450466572ba3fb95a7b7e84360e7e29db41415a74f3e277ea08ae1e61c18b89
7
+ data.tar.gz: a75c8be77b08ffd148e79c374451e65d31f7b5131e6254f0fa2da434885db24a7ebb1df6e84509c3715a1f46cde7a53dae8d4a326fc367c996c791c81a3926ce
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qwtf_discord_bot (5.5.25)
4
+ qwtf_discord_bot (6.0.0)
5
5
  discordrb (= 3.4.0)
6
6
  redis (~> 4.2)
7
7
  thor (~> 1.1)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.5.26
1
+ 6.0.1
data/docker-compose.yml CHANGED
@@ -35,6 +35,7 @@ services:
35
35
  environment:
36
36
  - REDIS_URL=redis://redis
37
37
  - RATINGS_API_URL
38
+ - RATINGS_APP_URL
38
39
  volumes:
39
40
  - type: bind
40
41
  source: "/home/ubuntu/.config/qwtf_discord_bot/config.yaml"
@@ -430,7 +430,7 @@ class QwtfDiscordBotPug # :nodoc:
430
430
  ).body
431
431
 
432
432
  send_embedded_message(
433
- description: "#{TEAM_NAMES[winning_team_no]} wins game ##{id}. `!choose` again. [Ratings](http://ratings.fortressone.org)",
433
+ description: "#{TEAM_NAMES[winning_team_no]} wins game ##{id}. `!choose` again. [Ratings](#{discord_channel_leaderboard_url(e.channel.id)})",
434
434
  channel: e.channel
435
435
  )
436
436
  end
@@ -498,7 +498,7 @@ class QwtfDiscordBotPug # :nodoc:
498
498
  ).body
499
499
 
500
500
  send_embedded_message(
501
- description: "Match ##{id} drawn. `!choose` again. [Ratings](http://ratings.fortressone.org)",
501
+ description: "Match ##{id} drawn. `!choose` again. [Ratings](#{discord_channel_leaderboard_url(e.channel.id)})",
502
502
  channel: e.channel
503
503
  )
504
504
  end
@@ -694,7 +694,10 @@ class QwtfDiscordBotPug # :nodoc:
694
694
  channel: event.channel
695
695
  )
696
696
 
697
- combinations = get_fair_teams(pug.joined_players)
697
+ combinations = get_fair_teams(
698
+ channel_id: event.channel.id, players: pug.joined_players
699
+ )
700
+
698
701
  teams = combinations[iteration]
699
702
 
700
703
  if !teams
@@ -814,7 +817,7 @@ class QwtfDiscordBotPug # :nodoc:
814
817
  end
815
818
 
816
819
  def post_results(json)
817
- uri = URI("#{ENV['RATINGS_API_URL']}matches/")
820
+ uri = URI([ENV['RATINGS_API_URL'], 'matches'].join('/'))
818
821
  req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
819
822
  req.body = json
820
823
 
@@ -823,9 +826,9 @@ class QwtfDiscordBotPug # :nodoc:
823
826
  end
824
827
  end
825
828
 
826
- def get_fair_teams(players)
827
- uri = URI("#{ENV['RATINGS_API_URL']}fair_teams/new")
828
- params = { 'players[]' => players }
829
+ def get_fair_teams(channel_id:, players:)
830
+ uri = URI([ENV['RATINGS_API_URL'], 'fair_teams', 'new'].join('/'))
831
+ params = { :channel_id => channel_id, 'players[]' => players }
829
832
  uri.query = URI.encode_www_form(params)
830
833
  req = Net::HTTP::Get.new(uri)
831
834
 
@@ -839,4 +842,8 @@ class QwtfDiscordBotPug # :nodoc:
839
842
  def ten_minutes_ago
840
843
  Time.now.to_i - TEN_MINUTES
841
844
  end
845
+
846
+ def discord_channel_leaderboard_url(channel_id)
847
+ [ENV['RATINGS_APP_URL'], "discord_channels", channel_id].join('/')
848
+ end
842
849
  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.5.26
4
+ version: 6.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sheldon Johnson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-23 00:00:00.000000000 Z
11
+ date: 2021-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: discordrb