qwtf_discord_bot 5.5.8 → 5.5.13
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 +4 -4
- data/README.md +7 -0
- data/VERSION +1 -1
- data/lib/dashboard.rb +18 -5
- data/lib/pug.rb +9 -0
- data/lib/qwtf_discord_bot/qwtf_discord_bot_pug.rb +14 -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: 43f3e7db0dcde510ced3d8854582e00e5cb38dc231495dc70d9b5b70f7f9627a
|
4
|
+
data.tar.gz: d159cfc3dae171fe78eaf7c0cece4d7ae38d6e1927a05bb67e2aa37eb2cc334d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 949ad6ac34383e8b284705f80c79e59b4aed603755a901e47744de5c9dac0e9407cfe3fdfffef158631c4bb762ac693d4f2455a90fb7fda42af592635260f4bd
|
7
|
+
data.tar.gz: 8beb3374d086b15923a0d443c08b970a3a0e60fd2c63aa825cb66a0cde3261ae569e18d8d9792add082b365285becb2eaee898ad8651a59c4f70eb00e4d052bc
|
data/README.md
CHANGED
@@ -56,6 +56,13 @@ A Discord bot for checking the status of QuakeWorld Team Fortress servers
|
|
56
56
|
hwguy: "<:hwguy_blue:456062063190736926>"
|
57
57
|
spy: "<:spy_blue:456062062032846849>"
|
58
58
|
engineer: "<:engineer_blue:456062031125020683>"
|
59
|
+
dashboards:
|
60
|
+
- server_id: 744911007859736616
|
61
|
+
name: "active-servers"
|
62
|
+
endpoints:
|
63
|
+
- "sydney.fortressone.org"
|
64
|
+
- "sydney.fortressone.org:27510"
|
65
|
+
- "dallas.fortressone.org"
|
59
66
|
```
|
60
67
|
|
61
68
|
- Use the `QWTF_DISCORD_BOT_CONFIG_FILE` environment variable to specify an
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.5.
|
1
|
+
5.5.13
|
data/lib/dashboard.rb
CHANGED
@@ -4,15 +4,28 @@ class Dashboard
|
|
4
4
|
@endpoints = dashboard_config["endpoints"]
|
5
5
|
@messages = {}
|
6
6
|
|
7
|
+
channel_name = dashboard_config["name"]
|
8
|
+
|
7
9
|
old_dashboard_channel = @server.channels.find do |chan|
|
8
|
-
chan.name ==
|
10
|
+
chan.name == channel_name
|
9
11
|
end
|
10
12
|
|
11
|
-
|
13
|
+
@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
|
12
18
|
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
16
29
|
end
|
17
30
|
|
18
31
|
def update
|
data/lib/pug.rb
CHANGED
@@ -16,6 +16,7 @@ class Pug
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def join_team(team_no:, player_id:)
|
19
|
+
redis.setnx(pug_key, Time.now.to_i)
|
19
20
|
leave_teams(player_id)
|
20
21
|
redis.sadd(team_key(team_no), player_id)
|
21
22
|
end
|
@@ -146,6 +147,14 @@ class Pug
|
|
146
147
|
redis.get(last_result_time_key).to_i
|
147
148
|
end
|
148
149
|
|
150
|
+
def equal_number_of_players_on_each_team?
|
151
|
+
team_player_counts = actual_teams.map do |_name, players|
|
152
|
+
players.size
|
153
|
+
end
|
154
|
+
|
155
|
+
team_player_counts.uniq.size == 1
|
156
|
+
end
|
157
|
+
|
149
158
|
private
|
150
159
|
|
151
160
|
def leave_teams(player_id)
|
@@ -356,6 +356,13 @@ class QwtfDiscordBotPug # :nodoc:
|
|
356
356
|
)
|
357
357
|
end
|
358
358
|
|
359
|
+
if pug.equal_number_of_players_on_each_team?
|
360
|
+
return send_embedded_message(
|
361
|
+
description: "Can't report unless teams have same number of players",
|
362
|
+
channel: event.channel
|
363
|
+
)
|
364
|
+
end
|
365
|
+
|
359
366
|
unless ["1", "2"].any?(args.first)
|
360
367
|
return send_embedded_message(
|
361
368
|
description: "Invalid team number",
|
@@ -429,6 +436,13 @@ class QwtfDiscordBotPug # :nodoc:
|
|
429
436
|
)
|
430
437
|
end
|
431
438
|
|
439
|
+
if pug.equal_number_of_players_on_each_team?
|
440
|
+
return send_embedded_message(
|
441
|
+
description: "Can't report unless teams have same number of players",
|
442
|
+
channel: event.channel
|
443
|
+
)
|
444
|
+
end
|
445
|
+
|
432
446
|
if pug.actual_teams.count < 2
|
433
447
|
return send_embedded_message(
|
434
448
|
description: "There must be at least two teams with players to submit a result",
|
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.
|
4
|
+
version: 5.5.13
|
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-
|
11
|
+
date: 2020-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: discordrb
|