qwtf_discord_bot 5.5.21 → 5.5.26

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: 1dbfe17b94ffb666f95b441f62ec327c1a1d14314868ce5fd8c4c1ef245eabd4
4
- data.tar.gz: c35a33f5698b68456af313fe11011f3da4403f792bbe211d283de108ded8fd3f
3
+ metadata.gz: 9c6d6a935efeff277da0a093cc9cbbca7dd76e33a8d4d8f0bf73664d32f7b766
4
+ data.tar.gz: c0ab537abc9fbe1c3f133e0eedf076348cbd5d1bad622bcc6e2cbc7a233421f2
5
5
  SHA512:
6
- metadata.gz: aa90484972ea80a47ef662e527a723b79bbc7210fc138714412a4102cca05299d71477b4307449790a523d1a2b4508c7a54cc1f243767d73361aa0ff8575e820
7
- data.tar.gz: 55511370e2de264b7516d4e0bd14ec5e2e49f808d9d763e0bcbf4cd132aebfb0dce7e265428419990444210a0c4df61eb637bea3451665bb62aed7dd5379048b
6
+ metadata.gz: ba9d17f6b5b3f5a69e97594135cf1b87463cabcaf55e18dbf1e72e89d6f01d2594f9281042f4fdd0d3f43e3c58c822167094d74c2dfbea87c11f08df67d20702
7
+ data.tar.gz: a12523817d0bb96dbffbcc2e038a862615412117b53dee96486085836be04ea70a1a3f42fe28e8d1f4a451bd60633d3f416670ab52b43ab0927c5328411cd919
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  gem 'bundler'
6
- gem 'discordrb'
6
+ gem 'discordrb', '3.4.0'
7
7
  gem 'redis'
8
8
  gem 'thor'
9
9
 
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qwtf_discord_bot (5.5.19)
5
- discordrb (~> 3.3)
4
+ qwtf_discord_bot (5.5.25)
5
+ discordrb (= 3.4.0)
6
6
  redis (~> 4.2)
7
7
  thor (~> 1.1)
8
8
 
@@ -18,14 +18,14 @@ GEM
18
18
  coderay (1.1.3)
19
19
  concurrent-ruby (1.1.8)
20
20
  diff-lcs (1.4.4)
21
- discordrb (3.4.2)
22
- discordrb-webhooks (~> 3.4.2)
21
+ discordrb (3.4.0)
22
+ discordrb-webhooks (~> 3.3.0)
23
23
  ffi (>= 1.9.24)
24
24
  opus-ruby
25
25
  rest-client (>= 2.0.0)
26
26
  websocket-client-simple (>= 0.3.0)
27
- discordrb-webhooks (3.4.2)
28
- rest-client (>= 2.0.0)
27
+ discordrb-webhooks (3.3.0)
28
+ rest-client (>= 2.1.0.rc1)
29
29
  domain_name (0.5.20190701)
30
30
  unf (>= 0.0.5, < 1.0.0)
31
31
  event_emitter (0.2.6)
@@ -84,7 +84,7 @@ PLATFORMS
84
84
 
85
85
  DEPENDENCIES
86
86
  bundler
87
- discordrb
87
+ discordrb (= 3.4.0)
88
88
  factory_bot
89
89
  pry
90
90
  qwtf_discord_bot!
data/README.md CHANGED
@@ -180,8 +180,8 @@ Build:
180
180
 
181
181
  Push:
182
182
 
183
- docker tag discord-bot fortressone/discord-bot:latest
184
- docker push fortressone/discord-bot:latest
183
+ docker tag discord-bot fortressone/discord-bot:latest \
184
+ && docker push fortressone/discord-bot:latest
185
185
 
186
186
 
187
187
  Create AWS instance:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.5.21
1
+ 5.5.26
data/lib/dashboard.rb CHANGED
@@ -2,6 +2,8 @@ class Dashboard
2
2
  def initialize(dashboard_config, bot)
3
3
  @server = bot.server(dashboard_config["server_id"])
4
4
  @endpoints = dashboard_config["endpoints"]
5
+ @messages = {}
6
+
5
7
 
6
8
  channel_name = dashboard_config["name"]
7
9
 
@@ -32,15 +34,13 @@ class Dashboard
32
34
  end
33
35
 
34
36
  def update
35
- messages = {}
36
-
37
37
  @endpoints.each do |endpoint|
38
38
  qstat_request = QstatRequest.new(endpoint)
39
39
 
40
40
  if qstat_request.is_empty?
41
- if messages[endpoint]
42
- messages[endpoint].delete
43
- messages.delete(endpoint)
41
+ if @messages[endpoint]
42
+ @messages[endpoint].delete
43
+ @messages.delete(endpoint)
44
44
  end
45
45
 
46
46
  next
@@ -48,8 +48,8 @@ class Dashboard
48
48
 
49
49
  embed = qstat_request.to_full_embed
50
50
 
51
- messages[endpoint] = if messages[endpoint]
52
- messages[endpoint].edit(nil, embed)
51
+ @messages[endpoint] = if @messages[endpoint]
52
+ @messages[endpoint].edit(nil, embed)
53
53
  else
54
54
  @channel.send_embed(nil, embed)
55
55
  end
data/lib/qstat_request.rb CHANGED
@@ -17,7 +17,7 @@ class QstatRequest
17
17
  embed = Discordrb::Webhooks::Embed.new
18
18
 
19
19
  teams.each do |team|
20
- embed.add_field << team.to_embed_field
20
+ embed << team.to_embed_field
21
21
  end
22
22
 
23
23
  embed
@@ -45,39 +45,39 @@ class QstatRequest
45
45
  def server_summary
46
46
  return "#{@endpoint} isn't responding" unless game_map
47
47
 
48
- if !has_spectators?
49
- return [
50
- name,
51
- @endpoint,
52
- game_map,
53
- "#{numplayers}/#{maxplayers}"
54
- ].join(MSG_SNIPPET_DELIMITER)
55
- end
48
+ info = [name, @endpoint, game_map]
49
+
50
+ info += if !has_spectators?
51
+ ["#{numplayers}/#{maxplayers}"]
52
+ else
53
+ [
54
+ "#{numplayers}/#{maxplayers} players",
55
+ "#{numspectators}/#{maxspectators} spectators"
56
+ ]
57
+ end
58
+
59
+ info.join(MSG_SNIPPET_DELIMITER)
60
+ end
56
61
 
57
- [
58
- name,
59
- @endpoint,
60
- game_map,
61
- "#{numplayers}/#{maxplayers} players",
62
- "#{numspectators}/#{maxspectators} spectators"
63
- ].join(MSG_SNIPPET_DELIMITER)
62
+ def join_link
63
+ "[Join](http://phobos.baseq.fr:9999/join?url=#{@endpoint})"
64
64
  end
65
65
 
66
66
  def embed_summary
67
- if !has_spectators?
68
- return [
69
- @endpoint,
70
- game_map,
71
- "#{numplayers}/#{maxplayers}"
72
- ].join(MSG_SNIPPET_DELIMITER)
73
- end
67
+ info = [@endpoint, game_map]
68
+
69
+ info += if !has_spectators?
70
+ ["#{numplayers}/#{maxplayers}"]
71
+ else
72
+ [
73
+ "#{numplayers}/#{maxplayers} players",
74
+ "#{numspectators}/#{maxspectators} spectators"
75
+ ]
76
+ end
74
77
 
75
- [
76
- @endpoint,
77
- game_map,
78
- "#{numplayers}/#{maxplayers} players",
79
- "#{numspectators}/#{maxspectators} spectators"
80
- ].join(MSG_SNIPPET_DELIMITER)
78
+ info << join_link
79
+
80
+ info.join(MSG_SNIPPET_DELIMITER)
81
81
  end
82
82
 
83
83
  def is_empty?
@@ -115,7 +115,10 @@ class QstatRequest
115
115
  end
116
116
 
117
117
  def name
118
- data['name']
118
+ name = data['name']
119
+ return address if name.empty?
120
+
121
+ name
119
122
  end
120
123
 
121
124
  def address
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ['lib']
29
29
 
30
- spec.add_runtime_dependency 'discordrb', '~> 3.3'
30
+ spec.add_runtime_dependency 'discordrb', '3.4.0'
31
31
  spec.add_runtime_dependency 'redis', '~> 4.2'
32
32
  spec.add_runtime_dependency 'thor', '~>1.1'
33
33
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qwtf_discord_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.21
4
+ version: 5.5.26
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-19 00:00:00.000000000 Z
11
+ date: 2021-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: discordrb
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: '3.3'
19
+ version: 3.4.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: '3.3'
26
+ version: 3.4.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: redis
29
29
  requirement: !ruby/object:Gem::Requirement