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 +4 -4
- data/Dockerfile +9 -0
- data/Gemfile.lock +1 -1
- data/README.md +23 -0
- data/docker-compose.yml +19 -0
- data/lib/qwtf_discord_bot/qwtf_discord_bot_server.rb +12 -5
- data/lib/qwtf_discord_bot/version.rb +1 -1
- data/server_screenshot.png +0 -0
- data/watcher_screenshot.png +0 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3dbe04f3aa38e4ba7715278ccfd0754d5b5c8d025fa0df69f230dfc991216b25
|
4
|
+
data.tar.gz: 5791575756f860aaf281bf9658f9199268df2d98125a27175b23501014a2570e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c753dcdc9655c83f660dfe8b5f0fb22000e7d958aaf4826ec8622b6a36a7f3c226ddd61a2776b051455666c8b1fb2318ffcbcbe65d40eda133a9e9b2a621e317
|
7
|
+
data.tar.gz: dfbe4203e2e6bef64e2c9cb7e09bc58de88871bae606649737a7f84183f254300f84170c07f25751fd9d558935c5f30523cf2b8b3d9aa30638f13a2fd72ed5ff
|
data/Dockerfile
ADDED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -73,6 +73,29 @@ they haven't been connected for more than ten minutes.
|
|
73
73
|

|
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).
|
data/docker-compose.yml
ADDED
@@ -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.
|
31
|
-
endpoint.channel_ids.
|
32
|
-
|
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
|
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
|
data/server_screenshot.png
CHANGED
Binary file
|
data/watcher_screenshot.png
CHANGED
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.
|
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-
|
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
|