qwtf_discord_bot 4.0.0 → 4.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53b110507d7aea432897ecfd3ee11c4837df5282b88941163e4fb8dd9b67aa83
4
- data.tar.gz: ffe4cefa3aa20ba3f091f157152b083929584a2331be84bb80d20cf3ada2786c
3
+ metadata.gz: 2f5b1587d8f32da40dd7b8be3f40959c4b90b8100aa19aad7fa6b2ab0cd4e8fe
4
+ data.tar.gz: b38f0808cf900202158cabcf5cbc9b1af2a034be896620aaa8acae400a8f6736
5
5
  SHA512:
6
- metadata.gz: f0701391ba3c5b82dfcef5188af67aeb70db9cb97503c449a4940fd9358512ff65f575fdebac353175b95fcbaac7b3f208cadc0f992921e954f6f1ada6830f5c
7
- data.tar.gz: a144dbdef8a1f08260501051e3667069a9f821d8718ec7f3f59dad1d8ab6b6a75fc2ae849e5ba0ae6b54f325421262a066ffbba9053deab9cccd8bc8b03d53b5
6
+ metadata.gz: fecee3c1bd3350ed33a3cb898b2c5ab7c811970de718b3fe6013ec130b4addbf9f4be2adbee8cb51d223b233f7ea6c0fe40a6e1b50d71c5263df5c42b65065a0
7
+ data.tar.gz: 4ea0bab8c81d1846af02cd2e512a950680e6210444a0fd93f32301d5774009dd89faac35d5ae2f035b804d486c8c5e114fbdd7c7f5463c4a969eb6dad7745631
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qwtf_discord_bot (4.0.0)
4
+ qwtf_discord_bot (4.0.1)
5
5
  discordrb (~> 3.3)
6
6
  thor (~> 0.20)
7
7
 
@@ -48,16 +48,26 @@ class QwtfDiscordBotServer < QwtfDiscordBot # :nodoc:
48
48
  end
49
49
 
50
50
  bot.command :active do |event|
51
- @endpoints.each do |endpoint|
52
- endpoint.channel_ids.each do |channel_id|
53
- next unless event.channel.id == channel_id
51
+ endpoints_for_this_channel = @endpoints.select do |endpoint|
52
+ endpoint.channel_ids.any? do |channel_id|
53
+ event.channel.id == channel_id
54
+ end
55
+ end
54
56
 
55
- qstat_request = QstatRequest.new(endpoint.address)
56
- next if qstat_request.is_empty?
57
+ qstat_requests = endpoints_for_this_channel.map do |endpoint|
58
+ QstatRequest.new(endpoint.address)
59
+ end
57
60
 
58
- message = qstat_request.server_summary
59
- embed = qstat_request.to_embed
61
+ servers_with_players = qstat_requests.reject do |server|
62
+ server.is_empty?
63
+ end
60
64
 
65
+ if servers_with_players.empty?
66
+ event.channel.send_message("All #{event.channel.name} servers are empty")
67
+ else
68
+ servers_with_players.each do |server|
69
+ message = server.server_summary
70
+ embed = server.to_embed
61
71
 
62
72
  if embed
63
73
  event.channel.send_embed(message, embed)
@@ -1,3 +1,3 @@
1
1
  class QwtfDiscordBot
2
- VERSION = '4.0.0'.freeze
2
+ VERSION = '4.0.1'.freeze
3
3
  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: 4.0.0
4
+ version: 4.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: 2019-06-21 00:00:00.000000000 Z
11
+ date: 2019-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: discordrb