qwtf_discord_bot 5.5.5 → 5.5.6

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: 1f51fa8d63ad6a2e6e0e08e3e83c851930694ba6208a70469d95f3322f3a5215
4
- data.tar.gz: f0d9139fab06e85aae6fe4d563cff3a13acd7ae88e0ba680c2add202a7c541e7
3
+ metadata.gz: 3b23056513d2164179b74059da9679cad97749b7b541a72c3cfc5dd5f4cf7f8e
4
+ data.tar.gz: cdea90ab6a7539a83aa4cb80a8c3766d0931c78ece2d197905b351b53b0a3540
5
5
  SHA512:
6
- metadata.gz: 0ac22beba9007bc30f809e3ab82ad382e078ba8036c71f91474ccad8b301b0b850a0b04dfa0529bfc4755aaa84bf82769846c72706dca4dcd7ca1c301f271457
7
- data.tar.gz: 341a554d68f4680b09d22dcdc08f16c711c6d86271811e66810d61f6660d628a1cac7a656ba23724e593d1ec638dd7512484cc5af2007ce6d1897b58cba30e64
6
+ metadata.gz: 0ae5e3ab1a227bfe61805e53ffdcdb5ceeb90b541eb693a7bb17f45cf510185a0efc004f3f8b6aabc11192aaf413ed5e0510d1720992efcf62d456baeda00169
7
+ data.tar.gz: 9c012e37ca4c35697513e5ff082d7ab5d6060b05280f9daa01e8aa156848a8cebb3594130e86b1fc3bfcdf148096c3c39ea024b1f01461e6d034aa618a79fb3f
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.5.5
1
+ 5.5.6
@@ -1,9 +1,18 @@
1
1
  class Dashboard
2
- def initialize(channel, bot)
3
- @channel_id = channel["id"]
4
- @endpoints = channel["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
+ old_dashboard_channel = @server.channels.find do |chan|
8
+ chan.name == "dashboard" && chan.topic = "QWTF Bot Dashboard"
9
+ end
10
+
11
+ old_dashboard_channel && old_dashboard_channel.delete
12
+
13
+ @channel = @server.create_channel("dashboard")
14
+ @channel.topic = "QWTF Bot Dashboard"
15
+ @channel.position = dashboard_config["position"]
7
16
  end
8
17
 
9
18
  def update
@@ -24,21 +33,8 @@ class Dashboard
24
33
  @messages[endpoint] = if @messages[endpoint]
25
34
  @messages[endpoint].edit(nil, embed)
26
35
  else
27
- channel.send_embed(nil, embed)
36
+ @channel.send_embed(nil, embed)
28
37
  end
29
38
  end
30
39
  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
40
  end
@@ -17,8 +17,10 @@ class QwtfDiscordBotDashboard
17
17
  end
18
18
  )
19
19
 
20
- @dashboards ||= QwtfDiscordBot.config.dashboards.map do |channel|
21
- Dashboard.new(channel, bot)
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.5
4
+ version: 5.5.6
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-27 00:00:00.000000000 Z
11
+ date: 2020-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: discordrb