qwtf_discord_bot 4.1.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a70ca5bf16d72a2a0ccfc6127011016b1c1e18c3a4212d202dcf5a071b69e194
4
- data.tar.gz: 055defe76720adc62871dd2c43d342a1161f6698a429c8b6f4ebdd47e9dfc42e
3
+ metadata.gz: 47aed33bbb5b34afc2ee892c69e263dd2f7b285093296182550247b5a69e93cd
4
+ data.tar.gz: c61ef338d9ee0a7cbf5152b844e68ec7499027967ffb8068c183124b8755113b
5
5
  SHA512:
6
- metadata.gz: 754aedabdd94d65c98a224201aff9794cffcd68fb2ad4f8f22346475a09e68e371ee957c338bbbf6a775af744ce73d1fd0b7cd7bcf06e46178dcde3a3c6b8e9c
7
- data.tar.gz: a414d546bdf7523df42ce3bd3d7a184050a2c2d80143743d23aed52f17298d54acad363d1791a63818df5d696879ad8ec2c691dec0ee400a07d58156ffbe81b7
6
+ metadata.gz: 00c74002efbd6841940510200baf240c78e616302b200309e83eb05b6ca09c2731fce8758936276227f86e5840563f409e044ea84baf92535ce9d3d62fad6d3d
7
+ data.tar.gz: bf3d7685d3e77607900fe9d63f9a50079d53e4a21b365931e8bdef6fe4c90c080e1781fbe44796e4e84ab2d7414e213999d5a261bbfec21b1e02844276446291
@@ -3,6 +3,7 @@ PATH
3
3
  specs:
4
4
  qwtf_discord_bot (4.1.0)
5
5
  discordrb (~> 3.3)
6
+ redis
6
7
  thor (~> 0.20)
7
8
 
8
9
  GEM
@@ -49,6 +50,7 @@ GEM
49
50
  method_source (~> 0.9.0)
50
51
  rbnacl (3.4.0)
51
52
  ffi
53
+ redis (4.1.3)
52
54
  rest-client (2.1.0.rc1)
53
55
  http-accept (>= 1.7.0, < 2.0)
54
56
  http-cookie (>= 1.0.2, < 2.0)
@@ -1,10 +1,14 @@
1
1
  ---
2
2
  version: "3.7"
3
3
  services:
4
+ redis:
5
+ image: redis:alpine
6
+ restart: always
4
7
  discord-command-bot:
5
8
  image: fortressone/discord-bot:latest
6
9
  command: "server"
7
10
  restart: always
11
+ depends_on: redis
8
12
  volumes:
9
13
  - type: bind
10
14
  source: /home/ubuntu/.config/qwtf_discord_bot/config.yaml
@@ -13,6 +17,9 @@ services:
13
17
  image: fortressone/discord-bot:latest
14
18
  command: "watcher"
15
19
  restart: always
20
+ depends_on: redis
21
+ environment:
22
+ - REDIS_URL=redis
16
23
  volumes:
17
24
  - type: bind
18
25
  source: /home/ubuntu/.config/qwtf_discord_bot/config.yaml
@@ -1,3 +1,5 @@
1
+ require "redis"
2
+
1
3
  class QwtfDiscordBotWatcher
2
4
  include QwtfDiscordBot
3
5
 
@@ -22,8 +24,7 @@ class QwtfDiscordBotWatcher
22
24
  end
23
25
  end
24
26
 
25
- history[address] ||= {}
26
- history[address][name] = Time.now
27
+ redis.set("#{address}:#{name}", Time.now)
27
28
  end
28
29
  end
29
30
  end
@@ -39,8 +40,8 @@ class QwtfDiscordBotWatcher
39
40
  end
40
41
 
41
42
  def seen_recently?(endpoint:, name:)
42
- last_seen = history[endpoint] && history[endpoint][name]
43
- last_seen && (Time.now - last_seen < TEN_MINUTES)
43
+ last_seen = redis.get("#{endpoint}:#{name}")
44
+ last_seen && (Time.now - Time.parse(last_seen) < TEN_MINUTES)
44
45
  end
45
46
 
46
47
  def report_joined(name:, channel_id:, server_summary:)
@@ -51,7 +52,9 @@ class QwtfDiscordBotWatcher
51
52
  )
52
53
  end
53
54
 
54
- def history
55
- @history ||= {}
55
+ private
56
+
57
+ def redis
58
+ @redis ||= Redis.new
56
59
  end
57
60
  end
@@ -1,3 +1,3 @@
1
1
  module QwtfDiscordBot
2
- VERSION = '4.1.0'.freeze
2
+ VERSION = '4.2.0'.freeze
3
3
  end
@@ -29,4 +29,5 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_runtime_dependency 'discordrb', '~> 3.3'
31
31
  spec.add_runtime_dependency 'thor', '~> 0.20'
32
+ spec.add_runtime_dependency 'redis'
32
33
  end
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.1.0
4
+ version: 4.2.0
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-07-13 00:00:00.000000000 Z
11
+ date: 2020-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: discordrb
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.20'
41
+ - !ruby/object:Gem::Dependency
42
+ name: redis
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: A Discord bot for reporting on QuakeWorld Team Fortress game servers
42
56
  email:
43
57
  - shayolden@hotmail.com
@@ -120,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
134
  version: '0'
121
135
  requirements: []
122
136
  rubyforge_project:
123
- rubygems_version: 2.7.6
137
+ rubygems_version: 2.7.6.2
124
138
  signing_key:
125
139
  specification_version: 4
126
140
  summary: Works by wrapping the excellent CLI server query tool qstat. Accepts !server,