qwtf_discord_bot 4.0.1 → 4.0.2

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: 2f5b1587d8f32da40dd7b8be3f40959c4b90b8100aa19aad7fa6b2ab0cd4e8fe
4
- data.tar.gz: b38f0808cf900202158cabcf5cbc9b1af2a034be896620aaa8acae400a8f6736
3
+ metadata.gz: 3dbe04f3aa38e4ba7715278ccfd0754d5b5c8d025fa0df69f230dfc991216b25
4
+ data.tar.gz: 5791575756f860aaf281bf9658f9199268df2d98125a27175b23501014a2570e
5
5
  SHA512:
6
- metadata.gz: fecee3c1bd3350ed33a3cb898b2c5ab7c811970de718b3fe6013ec130b4addbf9f4be2adbee8cb51d223b233f7ea6c0fe40a6e1b50d71c5263df5c42b65065a0
7
- data.tar.gz: 4ea0bab8c81d1846af02cd2e512a950680e6210444a0fd93f32301d5774009dd89faac35d5ae2f035b804d486c8c5e114fbdd7c7f5463c4a969eb6dad7745631
6
+ metadata.gz: c753dcdc9655c83f660dfe8b5f0fb22000e7d958aaf4826ec8622b6a36a7f3c226ddd61a2776b051455666c8b1fb2318ffcbcbe65d40eda133a9e9b2a621e317
7
+ data.tar.gz: dfbe4203e2e6bef64e2c9cb7e09bc58de88871bae606649737a7f84183f254300f84170c07f25751fd9d558935c5f30523cf2b8b3d9aa30638f13a2fd72ed5ff
@@ -0,0 +1,9 @@
1
+ FROM ruby:2.6
2
+ WORKDIR /discord-bot
3
+ RUN gem install qwtf_discord_bot
4
+ RUN git clone https://github.com/FortressOne/qstat.git
5
+ RUN cd qstat \
6
+ && ./autogen.sh \
7
+ && ./configure \
8
+ && make install
9
+ ENTRYPOINT ["qwtf_discord_bot"]
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qwtf_discord_bot (4.0.1)
4
+ qwtf_discord_bot (4.0.2)
5
5
  discordrb (~> 3.3)
6
6
  thor (~> 0.20)
7
7
 
data/README.md CHANGED
@@ -73,6 +73,29 @@ they haven't been connected for more than ten minutes.
73
73
  ![screenshot of bot reporting player joining server](watcher_screenshot.png)
74
74
 
75
75
 
76
+ ## Docker
77
+
78
+ Assuming a `./config.yaml` file exists:
79
+
80
+ Server:
81
+
82
+ ```sh
83
+ docker run -it --mount type=bind,source="$(pwd)"/config.yaml,target=/discord-bot/config.yaml discord-bot server
84
+ ```
85
+
86
+ Watcher:
87
+
88
+ ```sh
89
+ docker run -it --mount type=bind,source="$(pwd)"/config.yaml,target=/discord-bot/config.yaml discord-bot watcher
90
+ ```
91
+
92
+ Both:
93
+
94
+ ```sh
95
+ docker-compose up
96
+ ```
97
+
98
+
76
99
  ## License
77
100
 
78
101
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,19 @@
1
+ ---
2
+ version: "3.7"
3
+ services:
4
+ discord-command-bot:
5
+ image: fortressone/discord-bot:latest
6
+ command: "server"
7
+ restart: always
8
+ volumes:
9
+ - type: bind
10
+ source: ./config.yaml
11
+ target: /discord-bot/config.yaml
12
+ discord-watcher-bot:
13
+ image: fortressone/discord-bot:latest
14
+ command: "watcher"
15
+ restart: always
16
+ volumes:
17
+ - type: bind
18
+ source: ./config.yaml
19
+ target: /discord-bot/config.yaml
@@ -27,15 +27,22 @@ class QwtfDiscordBotServer < QwtfDiscordBot # :nodoc:
27
27
  end
28
28
 
29
29
  bot.command :all do |event|
30
- @endpoints.each do |endpoint|
31
- endpoint.channel_ids.each do |channel_id|
32
- next unless event.channel.id == channel_id
30
+ endpoints_for_this_channel = @endpoints.select do |endpoint|
31
+ endpoint.channel_ids.any? do |channel_id|
32
+ event.channel.id == channel_id
33
+ end
34
+ end
33
35
 
36
+ if endpoints_for_this_channel.empty?
37
+ event.channel.send_message(
38
+ 'There are no servers associated with this channel'
39
+ )
40
+ else
41
+ endpoints_for_this_channel.each do |endpoint|
34
42
  qstat_request = QstatRequest.new(endpoint.address)
35
43
  message = qstat_request.server_summary
36
44
  embed = qstat_request.to_embed
37
45
 
38
-
39
46
  if embed
40
47
  event.channel.send_embed(message, embed)
41
48
  else
@@ -63,7 +70,7 @@ class QwtfDiscordBotServer < QwtfDiscordBot # :nodoc:
63
70
  end
64
71
 
65
72
  if servers_with_players.empty?
66
- event.channel.send_message("All #{event.channel.name} servers are empty")
73
+ event.channel.send_message("All ##{event.channel.name} servers are empty")
67
74
  else
68
75
  servers_with_players.each do |server|
69
76
  message = server.server_summary
@@ -1,3 +1,3 @@
1
1
  class QwtfDiscordBot
2
- VERSION = '4.0.1'.freeze
2
+ VERSION = '4.0.2'.freeze
3
3
  end
Binary file
Binary file
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: 4.0.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sheldon Johnson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-22 00:00:00.000000000 Z
11
+ date: 2019-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: discordrb
@@ -46,10 +46,10 @@ executables:
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
- - ".env.example"
50
49
  - ".gitignore"
51
50
  - ".rspec"
52
51
  - ".travis.yml"
52
+ - Dockerfile
53
53
  - Gemfile
54
54
  - Gemfile.lock
55
55
  - LICENSE.txt
@@ -66,6 +66,7 @@ files:
66
66
  - bin/rspec
67
67
  - bin/setup
68
68
  - bin/thor
69
+ - docker-compose.yml
69
70
  - emoji/blue_demoman.png
70
71
  - emoji/blue_engineer.png
71
72
  - emoji/blue_hwguy.png