qwtf_discord_bot 4.2.4 → 4.2.5
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/Gemfile.lock +3 -2
- data/README.md +16 -4
- data/VERSION +1 -1
- data/docker-compose.yml +4 -4
- data/lib/qwtf_discord_bot/qwtf_discord_bot_server.rb +20 -12
- data/lib/qwtf_discord_bot/qwtf_discord_bot_watcher.rb +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdf030f78e4914930fa35ba81799674c650bad803bd0584af577403cf29c2261
|
4
|
+
data.tar.gz: 5a438d661bf43ff93d930c91404034c2428714d8737addc1f7f1af94c7f7a40b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b46ae60ca254852e8ead219ad24984caf61851c3326d68a70282cd01d0a16bc122c1592c6f72a7bd9d43e114caf56272aae0bebb430304f774e3e2f6e329868
|
7
|
+
data.tar.gz: 9487202134ac84b146381fbd8b07e29ed014b45badd3fe6faeefa079d58e4073195b08ab3067344b4c8d81451f97d9899ec37162e680eb5469b0a90b5c167d3c
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
qwtf_discord_bot (4.
|
4
|
+
qwtf_discord_bot (4.2.4)
|
5
5
|
discordrb (~> 3.3)
|
6
|
-
redis
|
6
|
+
redis (~> 4.1)
|
7
7
|
thor (~> 0.20)
|
8
8
|
|
9
9
|
GEM
|
@@ -90,6 +90,7 @@ DEPENDENCIES
|
|
90
90
|
factory_bot
|
91
91
|
pry
|
92
92
|
qwtf_discord_bot!
|
93
|
+
redis
|
93
94
|
rspec
|
94
95
|
thor
|
95
96
|
|
data/README.md
CHANGED
@@ -92,19 +92,20 @@ they haven't been connected for more than ten minutes.
|
|
92
92
|

|
93
93
|
|
94
94
|
|
95
|
-
##
|
95
|
+
## Gem
|
96
96
|
|
97
97
|
Build:
|
98
98
|
|
99
|
-
|
99
|
+
gem build qwtf_discrd_bot.gemspec
|
100
100
|
|
101
101
|
|
102
102
|
Push:
|
103
103
|
|
104
|
-
|
105
|
-
docker push fortressone/discord-bot:latest
|
104
|
+
gem push qwtf_discord_bot-$(cat VERSION).gem
|
106
105
|
|
107
106
|
|
107
|
+
## Docker
|
108
|
+
|
108
109
|
Run:
|
109
110
|
|
110
111
|
Assuming a `./config.yaml` file exists:
|
@@ -128,6 +129,17 @@ Only discord-bot watcher:
|
|
128
129
|
discord-bot watcher
|
129
130
|
|
130
131
|
|
132
|
+
Build:
|
133
|
+
|
134
|
+
docker build --tag=discord-bot .
|
135
|
+
|
136
|
+
|
137
|
+
Push:
|
138
|
+
|
139
|
+
docker tag discord-bot fortressone/discord-bot:latest
|
140
|
+
docker push fortressone/discord-bot:latest
|
141
|
+
|
142
|
+
|
131
143
|
## License
|
132
144
|
|
133
145
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.2.
|
1
|
+
4.2.5
|
data/docker-compose.yml
CHANGED
@@ -5,17 +5,17 @@ services:
|
|
5
5
|
image: redis:alpine
|
6
6
|
restart: always
|
7
7
|
discord-command-bot:
|
8
|
-
image:
|
8
|
+
image: discord-bot:latest
|
9
9
|
command: server
|
10
10
|
restart: always
|
11
11
|
depends_on:
|
12
12
|
- redis
|
13
13
|
volumes:
|
14
14
|
- type: bind
|
15
|
-
source:
|
15
|
+
source: "/home/ubuntu/.config/qwtf_discord_bot/config.yaml"
|
16
16
|
target: /discord-bot/config.yaml
|
17
17
|
discord-watcher-bot:
|
18
|
-
image:
|
18
|
+
image: discord-bot:latest
|
19
19
|
command: watcher
|
20
20
|
restart: always
|
21
21
|
depends_on:
|
@@ -24,5 +24,5 @@ services:
|
|
24
24
|
- REDIS_URL=redis://redis
|
25
25
|
volumes:
|
26
26
|
- type: bind
|
27
|
-
source:
|
27
|
+
source: "/home/ubuntu/.config/qwtf_discord_bot/config.yaml"
|
28
28
|
target: /discord-bot/config.yaml
|
@@ -8,10 +8,10 @@ class QwtfDiscordBotServer
|
|
8
8
|
|
9
9
|
bot.command :server do |event, *args|
|
10
10
|
if args.empty?
|
11
|
-
|
12
|
-
'
|
13
|
-
|
14
|
-
|
11
|
+
message = 'Provide a server address e.g. `!server ' \
|
12
|
+
'sydney.fortressone.org` or use `!active` or `!all`'
|
13
|
+
event.channel.send_message(message)
|
14
|
+
puts message
|
15
15
|
else
|
16
16
|
endpoint = args.first
|
17
17
|
qstat_response = QstatRequest.new(endpoint)
|
@@ -20,10 +20,13 @@ class QwtfDiscordBotServer
|
|
20
20
|
|
21
21
|
if embed
|
22
22
|
event.channel.send_embed(message, embed)
|
23
|
+
puts message
|
23
24
|
else
|
24
25
|
event.channel.send_message(message)
|
26
|
+
puts message
|
25
27
|
end
|
26
28
|
end
|
29
|
+
|
27
30
|
end
|
28
31
|
|
29
32
|
bot.command :all do |event|
|
@@ -34,9 +37,9 @@ class QwtfDiscordBotServer
|
|
34
37
|
end
|
35
38
|
|
36
39
|
if endpoints_for_this_channel.empty?
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
+
message = 'There are no servers associated with this channel'
|
41
|
+
event.channel.send_message(message)
|
42
|
+
puts message
|
40
43
|
else
|
41
44
|
endpoints_for_this_channel.each do |endpoint|
|
42
45
|
qstat_request = QstatRequest.new(endpoint.address)
|
@@ -45,8 +48,10 @@ class QwtfDiscordBotServer
|
|
45
48
|
|
46
49
|
if embed
|
47
50
|
event.channel.send_embed(message, embed)
|
51
|
+
puts message
|
48
52
|
else
|
49
53
|
event.channel.send_message(message)
|
54
|
+
puts message
|
50
55
|
end
|
51
56
|
end
|
52
57
|
end
|
@@ -62,9 +67,9 @@ class QwtfDiscordBotServer
|
|
62
67
|
end
|
63
68
|
|
64
69
|
if endpoints_for_this_channel.empty?
|
65
|
-
|
66
|
-
|
67
|
-
|
70
|
+
message = 'There are no servers associated with this channel'
|
71
|
+
event.channel.send_message(message)
|
72
|
+
puts message
|
68
73
|
else
|
69
74
|
qstat_requests = endpoints_for_this_channel.map do |endpoint|
|
70
75
|
QstatRequest.new(endpoint.address)
|
@@ -75,7 +80,9 @@ class QwtfDiscordBotServer
|
|
75
80
|
end
|
76
81
|
|
77
82
|
if servers_with_players.empty?
|
78
|
-
|
83
|
+
message = "All ##{event.channel.name} servers are empty"
|
84
|
+
event.channel.send_message(message)
|
85
|
+
puts message
|
79
86
|
else
|
80
87
|
servers_with_players.each do |server|
|
81
88
|
message = server.server_summary
|
@@ -83,13 +90,14 @@ class QwtfDiscordBotServer
|
|
83
90
|
|
84
91
|
if embed
|
85
92
|
event.channel.send_embed(message, embed)
|
93
|
+
puts message
|
86
94
|
else
|
87
95
|
event.channel.send_message(message)
|
96
|
+
puts message
|
88
97
|
end
|
89
98
|
end
|
90
99
|
end
|
91
100
|
end
|
92
|
-
|
93
101
|
return nil
|
94
102
|
end
|
95
103
|
|
@@ -51,11 +51,15 @@ class QwtfDiscordBotWatcher
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def report_joined(name:, channel_id:, server_summary:)
|
54
|
+
message = "#{name} has joined #{server_summary}"
|
55
|
+
|
54
56
|
Discordrb::API::Channel.create_message(
|
55
57
|
"Bot #{QwtfDiscordBot.config.token}",
|
56
58
|
channel_id,
|
57
|
-
|
59
|
+
message
|
58
60
|
)
|
61
|
+
|
62
|
+
puts message
|
59
63
|
end
|
60
64
|
|
61
65
|
private
|