qwtf_discord_bot 5.5.16 → 5.5.21

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: bb00493577fe32e4a2f0a73fd049bec1c195d08f710d559d3bc61f3c399f8e9a
4
- data.tar.gz: b9fe1647ba8814b8f2d25c5dbcaacd8c52c930f891f27fdded26028dae2ee392
3
+ metadata.gz: 1dbfe17b94ffb666f95b441f62ec327c1a1d14314868ce5fd8c4c1ef245eabd4
4
+ data.tar.gz: c35a33f5698b68456af313fe11011f3da4403f792bbe211d283de108ded8fd3f
5
5
  SHA512:
6
- metadata.gz: 03be912e0aa6aa8a46f9edad585bb4512aa1f22cf78689faabb4be646ba99bffe50cc03cddaf88e308c4fb40893d3d8107431dc2da3c7b59a809cec500d68381
7
- data.tar.gz: 73bd5b3b894f3e422d983f1295959cb6cd12f165d47f5ce9f86481e6ff6731226fdc9b909051d0d00df67c6b586fa124bd880d72d992ca2406a00c7e91a2bc40
6
+ metadata.gz: aa90484972ea80a47ef662e527a723b79bbc7210fc138714412a4102cca05299d71477b4307449790a523d1a2b4508c7a54cc1f243767d73361aa0ff8575e820
7
+ data.tar.gz: 55511370e2de264b7516d4e0bd14ec5e2e49f808d9d763e0bcbf4cd132aebfb0dce7e265428419990444210a0c4df61eb637bea3451665bb62aed7dd5379048b
data/Dockerfile CHANGED
@@ -1,5 +1,6 @@
1
- FROM ruby:2.6
1
+ FROM ruby:3.0
2
2
  WORKDIR /discord-bot/
3
+ RUN gem install bundler
3
4
  RUN git clone https://github.com/multiplay/qstat.git \
4
5
  && cd /discord-bot/qstat \
5
6
  && ./autogen.sh \
data/Gemfile.lock CHANGED
@@ -1,90 +1,86 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qwtf_discord_bot (5.3.5)
4
+ qwtf_discord_bot (5.5.19)
5
5
  discordrb (~> 3.3)
6
- redis (~> 4.1)
7
- thor (~> 0.20)
6
+ redis (~> 4.2)
7
+ thor (~> 1.1)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (6.0.3.2)
12
+ activesupport (6.1.3)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
- i18n (>= 0.7, < 2)
15
- minitest (~> 5.1)
16
- tzinfo (~> 1.1)
17
- zeitwerk (~> 2.2, >= 2.2.2)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ zeitwerk (~> 2.3)
18
18
  coderay (1.1.3)
19
- concurrent-ruby (1.1.7)
19
+ concurrent-ruby (1.1.8)
20
20
  diff-lcs (1.4.4)
21
- discordrb (3.3.0)
22
- discordrb-webhooks (~> 3.3.0)
21
+ discordrb (3.4.2)
22
+ discordrb-webhooks (~> 3.4.2)
23
23
  ffi (>= 1.9.24)
24
24
  opus-ruby
25
- rbnacl (~> 3.4.0)
26
- rest-client (>= 2.1.0.rc1)
25
+ rest-client (>= 2.0.0)
27
26
  websocket-client-simple (>= 0.3.0)
28
- discordrb-webhooks (3.3.0)
29
- rest-client (>= 2.1.0.rc1)
27
+ discordrb-webhooks (3.4.2)
28
+ rest-client (>= 2.0.0)
30
29
  domain_name (0.5.20190701)
31
30
  unf (>= 0.0.5, < 1.0.0)
32
31
  event_emitter (0.2.6)
33
32
  factory_bot (6.1.0)
34
33
  activesupport (>= 5.0.0)
35
- ffi (1.13.1)
34
+ ffi (1.14.2)
36
35
  http-accept (1.7.0)
37
36
  http-cookie (1.0.3)
38
37
  domain_name (~> 0.5)
39
- i18n (1.8.5)
38
+ i18n (1.8.9)
40
39
  concurrent-ruby (~> 1.0)
41
40
  method_source (1.0.0)
42
41
  mime-types (3.3.1)
43
42
  mime-types-data (~> 3.2015)
44
- mime-types-data (3.2020.0512)
45
- minitest (5.14.1)
43
+ mime-types-data (3.2021.0212)
44
+ minitest (5.14.3)
46
45
  netrc (0.11.0)
47
46
  opus-ruby (1.0.1)
48
47
  ffi
49
- pry (0.13.1)
48
+ pry (0.14.0)
50
49
  coderay (~> 1.1)
51
50
  method_source (~> 1.0)
52
- rbnacl (3.4.0)
53
- ffi
54
- redis (4.2.1)
51
+ redis (4.2.5)
55
52
  rest-client (2.1.0)
56
53
  http-accept (>= 1.7.0, < 2.0)
57
54
  http-cookie (>= 1.0.2, < 2.0)
58
55
  mime-types (>= 1.16, < 4.0)
59
56
  netrc (~> 0.8)
60
- rspec (3.9.0)
61
- rspec-core (~> 3.9.0)
62
- rspec-expectations (~> 3.9.0)
63
- rspec-mocks (~> 3.9.0)
64
- rspec-core (3.9.2)
65
- rspec-support (~> 3.9.3)
66
- rspec-expectations (3.9.2)
57
+ rspec (3.10.0)
58
+ rspec-core (~> 3.10.0)
59
+ rspec-expectations (~> 3.10.0)
60
+ rspec-mocks (~> 3.10.0)
61
+ rspec-core (3.10.1)
62
+ rspec-support (~> 3.10.0)
63
+ rspec-expectations (3.10.1)
67
64
  diff-lcs (>= 1.2.0, < 2.0)
68
- rspec-support (~> 3.9.0)
69
- rspec-mocks (3.9.1)
65
+ rspec-support (~> 3.10.0)
66
+ rspec-mocks (3.10.2)
70
67
  diff-lcs (>= 1.2.0, < 2.0)
71
- rspec-support (~> 3.9.0)
72
- rspec-support (3.9.3)
73
- thor (0.20.3)
74
- thread_safe (0.3.6)
75
- tzinfo (1.2.7)
76
- thread_safe (~> 0.1)
68
+ rspec-support (~> 3.10.0)
69
+ rspec-support (3.10.2)
70
+ thor (1.1.0)
71
+ tzinfo (2.0.4)
72
+ concurrent-ruby (~> 1.0)
77
73
  unf (0.1.4)
78
74
  unf_ext
79
75
  unf_ext (0.0.7.7)
80
- websocket (1.2.8)
76
+ websocket (1.2.9)
81
77
  websocket-client-simple (0.3.0)
82
78
  event_emitter
83
79
  websocket
84
- zeitwerk (2.4.0)
80
+ zeitwerk (2.4.2)
85
81
 
86
82
  PLATFORMS
87
- ruby
83
+ x86_64-linux
88
84
 
89
85
  DEPENDENCIES
90
86
  bundler
@@ -97,4 +93,4 @@ DEPENDENCIES
97
93
  thor
98
94
 
99
95
  BUNDLED WITH
100
- 1.17.2
96
+ 2.2.8
data/README.md CHANGED
@@ -126,12 +126,12 @@ they haven't been connected for more than ten minutes.
126
126
 
127
127
  Build:
128
128
 
129
- gem build qwtf_discrd_bot.gemspec
129
+ gem build qwtf_discord_bot.gemspec
130
130
 
131
131
 
132
132
  Install:
133
133
 
134
-
134
+
135
135
  gem install --local qwtf_discord_bot-$(cat VERSION).gem
136
136
 
137
137
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.5.16
1
+ 5.5.21
data/lib/dashboard.rb CHANGED
@@ -2,7 +2,6 @@ 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
  channel_name = dashboard_config["name"]
8
7
 
@@ -11,31 +10,37 @@ class Dashboard
11
10
  end
12
11
 
13
12
  @channel = if old_dashboard_channel
14
- position = old_dashboard_channel.position
15
- topic = old_dashboard_channel.topic
16
- category = old_dashboard_channel.category
17
- old_dashboard_channel.delete
18
-
19
- @server.create_channel(channel_name).tap do |channel|
20
- channel.position = position
21
- channel.topic = topic if topic
22
- channel.category = category if category
23
- end
24
- else
25
- @server.create_channel(channel_name).tap do |channel|
26
- channel.topic = "QWTF Bot Dashboard"
27
- end
28
- end
13
+ old_messages = JSON.parse(
14
+ Discordrb::API::Channel.messages(
15
+ "Bot #{QwtfDiscordBot.config.token}",
16
+ old_dashboard_channel.id,
17
+ 100
18
+ )
19
+ )
20
+
21
+ old_messages.each do |old_message|
22
+ sleep 2
23
+ old_dashboard_channel.message(old_message['id']).delete
24
+ end
25
+
26
+ old_dashboard_channel
27
+ else
28
+ @server.create_channel(channel_name).tap do |channel|
29
+ channel.topic = "QWTF Bot Dashboard"
30
+ end
31
+ end
29
32
  end
30
33
 
31
34
  def update
35
+ messages = {}
36
+
32
37
  @endpoints.each do |endpoint|
33
38
  qstat_request = QstatRequest.new(endpoint)
34
39
 
35
40
  if qstat_request.is_empty?
36
- if @messages[endpoint]
37
- @messages[endpoint].delete
38
- @messages.delete(endpoint)
41
+ if messages[endpoint]
42
+ messages[endpoint].delete
43
+ messages.delete(endpoint)
39
44
  end
40
45
 
41
46
  next
@@ -43,8 +48,8 @@ class Dashboard
43
48
 
44
49
  embed = qstat_request.to_full_embed
45
50
 
46
- @messages[endpoint] = if @messages[endpoint]
47
- @messages[endpoint].edit(nil, embed)
51
+ messages[endpoint] = if messages[endpoint]
52
+ messages[endpoint].edit(nil, embed)
48
53
  else
49
54
  @channel.send_embed(nil, embed)
50
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.add_field << team.to_embed_field
21
21
  end
22
22
 
23
23
  embed
@@ -31,7 +31,7 @@ class QstatRequest
31
31
  )
32
32
 
33
33
  teams.each do |team|
34
- embed.add_field(team.to_embed_field)
34
+ embed << team.to_embed_field
35
35
  end
36
36
  end
37
37
  end
@@ -647,7 +647,7 @@ class QwtfDiscordBotPug # :nodoc:
647
647
  private
648
648
 
649
649
  def team_name(team_no)
650
- return "No team" if team_no == 0
650
+ return "Queue" if team_no == 0
651
651
 
652
652
  [team_no, TEAM_NAMES[team_no]].join(" ")
653
653
  end
@@ -735,13 +735,9 @@ class QwtfDiscordBotPug # :nodoc:
735
735
  end
736
736
 
737
737
  embed.add_field(
738
- Discordrb::Webhooks::EmbedField.new(
739
- {
740
- inline: true,
741
- name: team_name(team_no),
742
- value: team_display_names.join("\n")
743
- }
744
- )
738
+ inline: true,
739
+ name: team_name(team_no),
740
+ value: team_display_names.join("\n")
745
741
  )
746
742
  end
747
743
  end
@@ -775,13 +771,9 @@ class QwtfDiscordBotPug # :nodoc:
775
771
  end
776
772
 
777
773
  embed.add_field(
778
- Discordrb::Webhooks::EmbedField.new(
779
- {
780
- inline: true,
781
- name: team_name(team_no),
782
- value: team_mentions.join("\n")
783
- }
784
- )
774
+ inline: true,
775
+ name: team_name(team_no),
776
+ value: team_mentions.join("\n")
785
777
  )
786
778
  end
787
779
  end
@@ -28,6 +28,6 @@ Gem::Specification.new do |spec|
28
28
  spec.require_paths = ['lib']
29
29
 
30
30
  spec.add_runtime_dependency 'discordrb', '~> 3.3'
31
- spec.add_runtime_dependency 'redis', '~> 4.1'
32
- spec.add_runtime_dependency 'thor', '~> 0.20'
31
+ spec.add_runtime_dependency 'redis', '~> 4.2'
32
+ spec.add_runtime_dependency 'thor', '~>1.1'
33
33
  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.16
4
+ version: 5.5.21
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-12-13 00:00:00.000000000 Z
11
+ date: 2021-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: discordrb
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '4.1'
33
+ version: '4.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '4.1'
40
+ version: '4.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: thor
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.20'
47
+ version: '1.1'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0.20'
54
+ version: '1.1'
55
55
  description: A Discord bot for reporting on QuakeWorld Team Fortress game servers
56
56
  email:
57
57
  - shayolden@hotmail.com
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubygems_version: 3.1.2
143
+ rubygems_version: 3.2.3
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Works by wrapping the excellent CLI server query tool qstat. Accepts !server,