qwtf_discord_bot 5.1.6 → 5.2.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 +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +4 -1
- data/VERSION +1 -1
- data/bin/bundle +24 -20
- data/bin/coderay +7 -7
- data/bin/console +0 -0
- data/bin/htmldiff +7 -7
- data/bin/ldiff +7 -7
- data/bin/pry +7 -7
- data/bin/qwtf_discord_bot +7 -7
- data/bin/restclient +7 -7
- data/bin/rspec +7 -7
- data/bin/thor +7 -7
- data/lib/endpoint.rb +1 -1
- data/lib/event_decorator.rb +8 -5
- data/lib/player.rb +2 -1
- data/lib/pug.rb +83 -24
- data/lib/qstat_request.rb +51 -49
- data/lib/qwtf_discord_bot.rb +1 -0
- data/lib/qwtf_discord_bot/config.rb +4 -4
- data/lib/qwtf_discord_bot/qwtf_discord_bot_pug.rb +222 -123
- data/lib/qwtf_discord_bot/qwtf_discord_bot_server.rb +0 -1
- data/lib/qwtf_discord_bot/qwtf_discord_bot_watcher.rb +1 -1
- data/lib/qwtf_discord_bot/version.rb +1 -1
- data/lib/team.rb +27 -24
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2adca9fb3f7b4a9f7e78544e5727dd1c93ceb908c25c0fcae46532439f69ceab
|
4
|
+
data.tar.gz: 120b8d090e1ba937d6ed89c1d3b625f7b6bcb40bc1e4774ed9ab473e89a04c26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc26082fafb956166f461d6eb948cd515d8eea35b4cf586dc80b55280128263de6aa01526db469127b0730835843295022f16c6b6b1d417f3ea7711ceebb4d60
|
7
|
+
data.tar.gz: 3f13b345fc9b666927d3a9f8536b25ffd20539ae4c093e93549594a7c9a1aad0b25d530d939dc0512a2439f255fd764140ef6b8c577c1d06619a65478cd77391
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -90,7 +90,10 @@ This responds to discord messages:
|
|
90
90
|
- `!leave`
|
91
91
|
- `!status`
|
92
92
|
- `!kick <@player>`
|
93
|
-
- `!
|
93
|
+
- `!teamsize <no_of_players>`
|
94
|
+
- `!team <team_no>`
|
95
|
+
- `!unteam`
|
96
|
+
- `!win <team_no>`
|
94
97
|
- `!notify <@role @role2>`
|
95
98
|
- `!end`
|
96
99
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.
|
1
|
+
5.2.6
|
data/bin/bundle
CHANGED
@@ -8,46 +8,46 @@
|
|
8
8
|
# this file is here to facilitate running it.
|
9
9
|
#
|
10
10
|
|
11
|
-
require
|
11
|
+
require 'rubygems'
|
12
12
|
|
13
13
|
m = Module.new do
|
14
|
-
|
14
|
+
module_function
|
15
15
|
|
16
16
|
def invoked_as_script?
|
17
17
|
File.expand_path($0) == File.expand_path(__FILE__)
|
18
18
|
end
|
19
19
|
|
20
20
|
def env_var_version
|
21
|
-
ENV[
|
21
|
+
ENV['BUNDLER_VERSION']
|
22
22
|
end
|
23
23
|
|
24
24
|
def cli_arg_version
|
25
25
|
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
-
return unless
|
26
|
+
return unless 'update'.start_with?(ARGV.first || ' ') # must be running `bundle update`
|
27
|
+
|
27
28
|
bundler_version = nil
|
28
29
|
update_index = nil
|
29
30
|
ARGV.each_with_index do |a, i|
|
30
|
-
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
-
bundler_version = a
|
32
|
-
end
|
31
|
+
bundler_version = a if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
33
32
|
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
-
|
33
|
+
|
34
|
+
bundler_version = Regexp.last_match(1) || '>= 0.a'
|
35
35
|
update_index = i
|
36
36
|
end
|
37
37
|
bundler_version
|
38
38
|
end
|
39
39
|
|
40
40
|
def gemfile
|
41
|
-
gemfile = ENV[
|
41
|
+
gemfile = ENV['BUNDLE_GEMFILE']
|
42
42
|
return gemfile if gemfile && !gemfile.empty?
|
43
43
|
|
44
|
-
File.expand_path(
|
44
|
+
File.expand_path('../Gemfile', __dir__)
|
45
45
|
end
|
46
46
|
|
47
47
|
def lockfile
|
48
48
|
lockfile =
|
49
49
|
case File.basename(gemfile)
|
50
|
-
when
|
50
|
+
when 'gems.rb' then gemfile.sub(/\.rb$/, gemfile)
|
51
51
|
else "#{gemfile}.lock"
|
52
52
|
end
|
53
53
|
File.expand_path(lockfile)
|
@@ -55,8 +55,10 @@ m = Module.new do
|
|
55
55
|
|
56
56
|
def lockfile_version
|
57
57
|
return unless File.file?(lockfile)
|
58
|
+
|
58
59
|
lockfile_contents = File.read(lockfile)
|
59
60
|
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
61
|
+
|
60
62
|
Regexp.last_match(1)
|
61
63
|
end
|
62
64
|
|
@@ -68,24 +70,28 @@ m = Module.new do
|
|
68
70
|
end
|
69
71
|
|
70
72
|
def load_bundler!
|
71
|
-
ENV[
|
73
|
+
ENV['BUNDLE_GEMFILE'] ||= gemfile
|
72
74
|
|
73
75
|
# must dup string for RG < 1.8 compatibility
|
74
76
|
activate_bundler(bundler_version.dup)
|
75
77
|
end
|
76
78
|
|
77
79
|
def activate_bundler(bundler_version)
|
78
|
-
if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new(
|
79
|
-
bundler_version =
|
80
|
+
if Gem::Version.correct?(bundler_version) && Gem::Version.new(bundler_version).release < Gem::Version.new('2.0')
|
81
|
+
bundler_version = '< 2'
|
80
82
|
end
|
81
83
|
gem_error = activation_error_handling do
|
82
|
-
gem
|
84
|
+
gem 'bundler', bundler_version
|
83
85
|
end
|
84
86
|
return if gem_error.nil?
|
87
|
+
|
85
88
|
require_error = activation_error_handling do
|
86
|
-
require
|
89
|
+
require 'bundler/version'
|
90
|
+
end
|
91
|
+
if require_error.nil? && Gem::Requirement.new(bundler_version).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
92
|
+
return
|
87
93
|
end
|
88
|
-
|
94
|
+
|
89
95
|
warn "Activating bundler (#{bundler_version}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_version}'`"
|
90
96
|
exit 42
|
91
97
|
end
|
@@ -100,6 +106,4 @@ end
|
|
100
106
|
|
101
107
|
m.load_bundler!
|
102
108
|
|
103
|
-
if m.invoked_as_script?
|
104
|
-
load Gem.bin_path("bundler", "bundle")
|
105
|
-
end
|
109
|
+
load Gem.bin_path('bundler', 'bundle') if m.invoked_as_script?
|
data/bin/coderay
CHANGED
@@ -8,11 +8,11 @@
|
|
8
8
|
# this file is here to facilitate running it.
|
9
9
|
#
|
10
10
|
|
11
|
-
require
|
12
|
-
ENV[
|
13
|
-
|
11
|
+
require 'pathname'
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
14
|
|
15
|
-
bundle_binstub = File.expand_path(
|
15
|
+
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
16
|
|
17
17
|
if File.file?(bundle_binstub)
|
18
18
|
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
@@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
require
|
27
|
-
require
|
26
|
+
require 'rubygems'
|
27
|
+
require 'bundler/setup'
|
28
28
|
|
29
|
-
load Gem.bin_path(
|
29
|
+
load Gem.bin_path('coderay', 'coderay')
|
data/bin/console
CHANGED
File without changes
|
data/bin/htmldiff
CHANGED
@@ -8,11 +8,11 @@
|
|
8
8
|
# this file is here to facilitate running it.
|
9
9
|
#
|
10
10
|
|
11
|
-
require
|
12
|
-
ENV[
|
13
|
-
|
11
|
+
require 'pathname'
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
14
|
|
15
|
-
bundle_binstub = File.expand_path(
|
15
|
+
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
16
|
|
17
17
|
if File.file?(bundle_binstub)
|
18
18
|
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
@@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
require
|
27
|
-
require
|
26
|
+
require 'rubygems'
|
27
|
+
require 'bundler/setup'
|
28
28
|
|
29
|
-
load Gem.bin_path(
|
29
|
+
load Gem.bin_path('diff-lcs', 'htmldiff')
|
data/bin/ldiff
CHANGED
@@ -8,11 +8,11 @@
|
|
8
8
|
# this file is here to facilitate running it.
|
9
9
|
#
|
10
10
|
|
11
|
-
require
|
12
|
-
ENV[
|
13
|
-
|
11
|
+
require 'pathname'
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
14
|
|
15
|
-
bundle_binstub = File.expand_path(
|
15
|
+
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
16
|
|
17
17
|
if File.file?(bundle_binstub)
|
18
18
|
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
@@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
require
|
27
|
-
require
|
26
|
+
require 'rubygems'
|
27
|
+
require 'bundler/setup'
|
28
28
|
|
29
|
-
load Gem.bin_path(
|
29
|
+
load Gem.bin_path('diff-lcs', 'ldiff')
|
data/bin/pry
CHANGED
@@ -8,11 +8,11 @@
|
|
8
8
|
# this file is here to facilitate running it.
|
9
9
|
#
|
10
10
|
|
11
|
-
require
|
12
|
-
ENV[
|
13
|
-
|
11
|
+
require 'pathname'
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
14
|
|
15
|
-
bundle_binstub = File.expand_path(
|
15
|
+
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
16
|
|
17
17
|
if File.file?(bundle_binstub)
|
18
18
|
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
@@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
require
|
27
|
-
require
|
26
|
+
require 'rubygems'
|
27
|
+
require 'bundler/setup'
|
28
28
|
|
29
|
-
load Gem.bin_path(
|
29
|
+
load Gem.bin_path('pry', 'pry')
|
data/bin/qwtf_discord_bot
CHANGED
@@ -8,11 +8,11 @@
|
|
8
8
|
# this file is here to facilitate running it.
|
9
9
|
#
|
10
10
|
|
11
|
-
require
|
12
|
-
ENV[
|
13
|
-
|
11
|
+
require 'pathname'
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
14
|
|
15
|
-
bundle_binstub = File.expand_path(
|
15
|
+
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
16
|
|
17
17
|
if File.file?(bundle_binstub)
|
18
18
|
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
@@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
require
|
27
|
-
require
|
26
|
+
require 'rubygems'
|
27
|
+
require 'bundler/setup'
|
28
28
|
|
29
|
-
load Gem.bin_path(
|
29
|
+
load Gem.bin_path('qwtf_discord_bot', 'qwtf_discord_bot')
|
data/bin/restclient
CHANGED
@@ -8,11 +8,11 @@
|
|
8
8
|
# this file is here to facilitate running it.
|
9
9
|
#
|
10
10
|
|
11
|
-
require
|
12
|
-
ENV[
|
13
|
-
|
11
|
+
require 'pathname'
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
14
|
|
15
|
-
bundle_binstub = File.expand_path(
|
15
|
+
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
16
|
|
17
17
|
if File.file?(bundle_binstub)
|
18
18
|
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
@@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
require
|
27
|
-
require
|
26
|
+
require 'rubygems'
|
27
|
+
require 'bundler/setup'
|
28
28
|
|
29
|
-
load Gem.bin_path(
|
29
|
+
load Gem.bin_path('rest-client', 'restclient')
|
data/bin/rspec
CHANGED
@@ -8,11 +8,11 @@
|
|
8
8
|
# this file is here to facilitate running it.
|
9
9
|
#
|
10
10
|
|
11
|
-
require
|
12
|
-
ENV[
|
13
|
-
|
11
|
+
require 'pathname'
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
14
|
|
15
|
-
bundle_binstub = File.expand_path(
|
15
|
+
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
16
|
|
17
17
|
if File.file?(bundle_binstub)
|
18
18
|
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
@@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
require
|
27
|
-
require
|
26
|
+
require 'rubygems'
|
27
|
+
require 'bundler/setup'
|
28
28
|
|
29
|
-
load Gem.bin_path(
|
29
|
+
load Gem.bin_path('rspec-core', 'rspec')
|
data/bin/thor
CHANGED
@@ -8,11 +8,11 @@
|
|
8
8
|
# this file is here to facilitate running it.
|
9
9
|
#
|
10
10
|
|
11
|
-
require
|
12
|
-
ENV[
|
13
|
-
|
11
|
+
require 'pathname'
|
12
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
|
13
|
+
Pathname.new(__FILE__).realpath)
|
14
14
|
|
15
|
-
bundle_binstub = File.expand_path(
|
15
|
+
bundle_binstub = File.expand_path('bundle', __dir__)
|
16
16
|
|
17
17
|
if File.file?(bundle_binstub)
|
18
18
|
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
@@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
require
|
27
|
-
require
|
26
|
+
require 'rubygems'
|
27
|
+
require 'bundler/setup'
|
28
28
|
|
29
|
-
load Gem.bin_path(
|
29
|
+
load Gem.bin_path('thor', 'thor')
|
data/lib/endpoint.rb
CHANGED
data/lib/event_decorator.rb
CHANGED
@@ -23,16 +23,20 @@ class EventDecorator
|
|
23
23
|
server.users
|
24
24
|
end
|
25
25
|
|
26
|
+
def mention_for(user_id)
|
27
|
+
find_user(user_id)&.mention
|
28
|
+
end
|
29
|
+
|
26
30
|
def mentions_for(user_ids)
|
27
31
|
find_users(user_ids).map(&:mention)
|
28
32
|
end
|
29
33
|
|
30
|
-
def
|
31
|
-
|
34
|
+
def display_name_for(user_id)
|
35
|
+
find_user(user_id)&.display_name
|
32
36
|
end
|
33
37
|
|
34
|
-
def
|
35
|
-
|
38
|
+
def display_names_for(user_ids)
|
39
|
+
find_users(user_ids).map(&:display_name)
|
36
40
|
end
|
37
41
|
|
38
42
|
private
|
@@ -55,4 +59,3 @@ class EventDecorator
|
|
55
59
|
@event.user
|
56
60
|
end
|
57
61
|
end
|
58
|
-
|
data/lib/player.rb
CHANGED
data/lib/pug.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
class Pug
|
2
|
-
|
2
|
+
DEFAULT_TEAMSIZE = 4
|
3
|
+
MIN_NO_OF_TEAMS = 2
|
3
4
|
|
4
5
|
def self.for(channel_id)
|
5
6
|
new(channel_id)
|
@@ -9,13 +10,29 @@ class Pug
|
|
9
10
|
@channel_id = channel_id
|
10
11
|
end
|
11
12
|
|
12
|
-
def join(
|
13
|
+
def join(player_id)
|
13
14
|
redis.setnx(pug_key, Time.now)
|
14
|
-
|
15
|
+
|
16
|
+
redis.sadd(team_key(0), player_id)
|
17
|
+
end
|
18
|
+
|
19
|
+
def join_team(team_no:, player_id:)
|
20
|
+
leave_teams(player_id)
|
21
|
+
redis.sadd(team_key(team_no), player_id)
|
15
22
|
end
|
16
23
|
|
17
24
|
def joined_players
|
18
|
-
|
25
|
+
teams_keys.inject([]) do |players, team|
|
26
|
+
players + redis.smembers(team).map(&:to_i)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def team(number)
|
31
|
+
redis.smembers(team_key(number)).map(&:to_i)
|
32
|
+
end
|
33
|
+
|
34
|
+
def teamsize=(teamsize)
|
35
|
+
redis.set(teamsize_key, teamsize)
|
19
36
|
end
|
20
37
|
|
21
38
|
def full?
|
@@ -23,7 +40,11 @@ class Pug
|
|
23
40
|
end
|
24
41
|
|
25
42
|
def joined_player_count
|
26
|
-
|
43
|
+
joined_players.count
|
44
|
+
end
|
45
|
+
|
46
|
+
def team_player_count(team_no)
|
47
|
+
redis.scard(team_key(team_no)).to_i
|
27
48
|
end
|
28
49
|
|
29
50
|
def player_slots
|
@@ -39,15 +60,11 @@ class Pug
|
|
39
60
|
end
|
40
61
|
|
41
62
|
def notify_roles
|
42
|
-
redis.get(notify_roles_key) ||
|
63
|
+
redis.get(notify_roles_key) || '@here'
|
43
64
|
end
|
44
65
|
|
45
|
-
def
|
46
|
-
redis.
|
47
|
-
end
|
48
|
-
|
49
|
-
def maxplayers
|
50
|
-
(redis.get(maxplayers_key) || DEFAULT_MAXPLAYERS).to_i
|
66
|
+
def teamsize
|
67
|
+
(redis.get(teamsize_key) || DEFAULT_TEAMSIZE).to_i
|
51
68
|
end
|
52
69
|
|
53
70
|
def active?
|
@@ -55,37 +72,79 @@ class Pug
|
|
55
72
|
end
|
56
73
|
|
57
74
|
def leave(player_id)
|
58
|
-
|
75
|
+
leave_teams(player_id)
|
76
|
+
end_pug if empty?
|
59
77
|
end
|
60
78
|
|
61
|
-
def
|
62
|
-
|
79
|
+
def end_pug
|
80
|
+
redis.keys([pug_key, "*"].join).each do |key|
|
81
|
+
redis.del(key)
|
82
|
+
end
|
63
83
|
end
|
64
84
|
|
65
|
-
def
|
66
|
-
|
67
|
-
|
85
|
+
def joined?(player_id)
|
86
|
+
joined_players.include?(player_id)
|
87
|
+
end
|
88
|
+
|
89
|
+
def maxplayers
|
90
|
+
teamsize * no_of_teams
|
91
|
+
end
|
92
|
+
|
93
|
+
def won_by(team_no)
|
94
|
+
{ teams: teams, winner: team_no }
|
95
|
+
end
|
96
|
+
|
97
|
+
def teams
|
98
|
+
teams_keys.inject({}) do |teams, team|
|
99
|
+
teams.merge({ team.split(':').last => redis.smembers(team).map(&:to_i) })
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def actual_teams
|
104
|
+
teams.tap { |team| team.delete("0") }
|
68
105
|
end
|
69
106
|
|
70
107
|
private
|
71
108
|
|
72
|
-
def
|
73
|
-
|
109
|
+
def leave_teams(player_id)
|
110
|
+
teams_keys.each do |team|
|
111
|
+
redis.srem(team, player_id)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def teams_keys
|
116
|
+
redis.keys([pug_key, 'teams:*'].join(':'))
|
74
117
|
end
|
75
118
|
|
76
|
-
def
|
77
|
-
|
119
|
+
def empty?
|
120
|
+
joined_player_count.zero?
|
121
|
+
end
|
122
|
+
|
123
|
+
def team_key(team_no)
|
124
|
+
[pug_key, 'teams', team_no].join(':')
|
78
125
|
end
|
79
126
|
|
80
127
|
def pug_key
|
81
|
-
[
|
128
|
+
[channel_key, 'pug'].join(':')
|
129
|
+
end
|
130
|
+
|
131
|
+
def channel_key
|
132
|
+
['channel', @channel_id].join(':')
|
82
133
|
end
|
83
134
|
|
84
135
|
def notify_roles_key
|
85
|
-
[
|
136
|
+
[channel_key, 'role'].join(':')
|
137
|
+
end
|
138
|
+
|
139
|
+
def teamsize_key
|
140
|
+
[channel_key, 'teamsize'].join(':')
|
86
141
|
end
|
87
142
|
|
88
143
|
def redis
|
89
144
|
Redis.current
|
90
145
|
end
|
146
|
+
|
147
|
+
def no_of_teams
|
148
|
+
[actual_teams.count, MIN_NO_OF_TEAMS].max
|
149
|
+
end
|
91
150
|
end
|