qwtf_discord_bot 5.5.5 → 5.5.10
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 +27 -18
- data/lib/qwtf_discord_bot/qwtf_discord_bot_dashboard.rb +4 -2
- 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: ebe547dbec4ffa7cf1974c4c7286249329dec4a0947569281c811cef8bf170c8
|
4
|
+
data.tar.gz: fcefedfbb7f73aff24ed6765dbd4e0da18cfb296ac1978d97ddbf054db4c5b47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c805e76c390c327d8b6ed53c6a757fa2d844561fe8a65d074874420800e9dedddaac1a70aafcc00f84d8cbda4587913d34342554bd70bd8de3c3a8dd6d5adf6b
|
7
|
+
data.tar.gz: 66165f24f18f1e910a35420767a0f86db1d5fcf9d404091e93775490287daff90999e2fcc6efd5e06c8ca3197591d0b0f90964a127bcd60c66765b7820552b73
|
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.10
|
data/lib/dashboard.rb
CHANGED
@@ -1,9 +1,31 @@
|
|
1
1
|
class Dashboard
|
2
|
-
def initialize(
|
3
|
-
@
|
4
|
-
@endpoints =
|
5
|
-
@bot = bot
|
2
|
+
def initialize(dashboard_config, bot)
|
3
|
+
@server = bot.server(dashboard_config["server_id"])
|
4
|
+
@endpoints = dashboard_config["endpoints"]
|
6
5
|
@messages = {}
|
6
|
+
|
7
|
+
channel_name = dashboard_config["name"]
|
8
|
+
|
9
|
+
old_dashboard_channel = @server.channels.find do |chan|
|
10
|
+
chan.name == channel_name
|
11
|
+
end
|
12
|
+
|
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
|
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
|
7
29
|
end
|
8
30
|
|
9
31
|
def update
|
@@ -24,21 +46,8 @@ class Dashboard
|
|
24
46
|
@messages[endpoint] = if @messages[endpoint]
|
25
47
|
@messages[endpoint].edit(nil, embed)
|
26
48
|
else
|
27
|
-
channel.send_embed(nil, embed)
|
49
|
+
@channel.send_embed(nil, embed)
|
28
50
|
end
|
29
51
|
end
|
30
52
|
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def channel
|
35
|
-
@channel ||= begin
|
36
|
-
data = Discordrb::API::Channel.resolve(
|
37
|
-
"Bot #{QwtfDiscordBot.config.token}",
|
38
|
-
@channel_id
|
39
|
-
)
|
40
|
-
|
41
|
-
Discordrb::Channel.new(JSON.parse(data), @bot)
|
42
|
-
end
|
43
|
-
end
|
44
53
|
end
|
@@ -17,8 +17,10 @@ class QwtfDiscordBotDashboard
|
|
17
17
|
end
|
18
18
|
)
|
19
19
|
|
20
|
-
|
21
|
-
|
20
|
+
bot.run(true)
|
21
|
+
|
22
|
+
@dashboards ||= QwtfDiscordBot.config.dashboards.map do |dashboard_config|
|
23
|
+
Dashboard.new(dashboard_config, bot)
|
22
24
|
end
|
23
25
|
|
24
26
|
every(THIRTY_SECONDS) do
|
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.10
|
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-
|
11
|
+
date: 2020-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: discordrb
|