qwtf_discord_bot 5.1.9 → 5.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/event_decorator.rb +1 -1
- data/lib/qwtf_discord_bot/qwtf_discord_bot_pug.rb +72 -69
- 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: 9f929cda85f6a53ffc63d04e3a85b6ca4bcbcadf72b2c0ab70eab8a1a549843a
|
4
|
+
data.tar.gz: 45b0e4b9bba67fdfb8139d3904176ce3443d43ea7cb74c750588f4eb6ea1fb8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cca2b1392fbbdca102e22ea27e79774da07478e5cfa2a9a2ee14c4b6ae48ae1ea3c8e4c8906461d123a1f32f3e2e0cef519f107a3b7abf42d1853a5e870bf342
|
7
|
+
data.tar.gz: d29bd7a09c9ffed879429965497118d0f63332bac8084c83ea498601d924d11227adad67694de73f97658b73ed9c7c90236fc855bb8c82a809a522fe0ecb78f6
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.1.
|
1
|
+
5.1.11
|
data/lib/event_decorator.rb
CHANGED
@@ -16,31 +16,18 @@ class QwtfDiscordBotPug # :nodoc:
|
|
16
16
|
|
17
17
|
bot.command :join do |event, *args|
|
18
18
|
setup_pug(event) do |e, pug|
|
19
|
-
return
|
19
|
+
return send_msg("You've already joined", e.channel) if pug.joined?(e.user_id)
|
20
20
|
|
21
21
|
pug.join(e.user_id)
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
"#{e.display_name} joins the PUG",
|
32
|
-
pug.player_slots,
|
33
|
-
"#{pug.slots_left} more",
|
34
|
-
pug.notify_roles
|
35
|
-
].join(' | ')
|
36
|
-
else
|
37
|
-
[
|
38
|
-
"#{e.display_name} joins the PUG",
|
39
|
-
pug.player_slots
|
40
|
-
].join(' | ')
|
41
|
-
end
|
42
|
-
|
43
|
-
message(message, e.channel)
|
23
|
+
if pug.joined_player_count == 1
|
24
|
+
snippets = ["#{e.display_name} creates a PUG", pug.player_slots, pug.notify_roles]
|
25
|
+
else
|
26
|
+
snippets = ["#{e.display_name} joins the PUG", pug.player_slots]
|
27
|
+
snippets << "#{pug.slots_left} more #{pug.notify_roles}" if pug.slots_left.between?(1, 3)
|
28
|
+
end
|
29
|
+
|
30
|
+
send_msg(snippets.join(' | '), e.channel)
|
44
31
|
|
45
32
|
start_pug(pug, e) if pug.full?
|
46
33
|
end
|
@@ -48,16 +35,16 @@ class QwtfDiscordBotPug # :nodoc:
|
|
48
35
|
|
49
36
|
bot.command :status do |event, *args|
|
50
37
|
setup_pug(event) do |e, pug|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
38
|
+
msg = if pug.active?
|
39
|
+
[
|
40
|
+
"#{e.display_names_for(pug.joined_players).join(', ')} joined",
|
41
|
+
pug.player_slots
|
42
|
+
].join(' | ')
|
43
|
+
else
|
44
|
+
'No PUG has been started. `!join` to create'
|
45
|
+
end
|
46
|
+
|
47
|
+
send_msg(msg, e.channel)
|
61
48
|
end
|
62
49
|
end
|
63
50
|
|
@@ -67,13 +54,15 @@ class QwtfDiscordBotPug # :nodoc:
|
|
67
54
|
|
68
55
|
if new_teamsize
|
69
56
|
pug.teamsize = new_teamsize
|
70
|
-
|
57
|
+
|
58
|
+
send_msg(
|
71
59
|
"Team size set to #{pug.teamsize} | #{pug.player_slots} joined",
|
72
60
|
e.channel
|
73
61
|
)
|
62
|
+
|
74
63
|
start_pug(pug, e) if pug.full?
|
75
64
|
else
|
76
|
-
|
65
|
+
send_msg(
|
77
66
|
"Current team size is #{pug.teamsize} | #{pug.player_slots} joined",
|
78
67
|
e.channel
|
79
68
|
)
|
@@ -83,56 +72,71 @@ class QwtfDiscordBotPug # :nodoc:
|
|
83
72
|
|
84
73
|
bot.command :leave do |event, *args|
|
85
74
|
setup_pug(event) do |e, pug|
|
86
|
-
return
|
87
|
-
return
|
75
|
+
return send_msg(no_active_pug_message, e.channel) unless pug.active?
|
76
|
+
return send_msg("You're not in the PUG", e.channel) unless pug.joined?(e.user_id)
|
88
77
|
|
89
78
|
pug.leave(e.user_id)
|
90
79
|
|
91
|
-
|
92
|
-
"#{e.display_name} leaves the PUG
|
80
|
+
snippets = [
|
81
|
+
"#{e.display_name} leaves the PUG",
|
82
|
+
"#{pug.player_slots} remain"
|
83
|
+
]
|
84
|
+
|
85
|
+
snippets << "#{pug.slots_left} more #{pug.notify_roles}" if pug.slots_left == 1
|
86
|
+
|
87
|
+
send_msg(
|
88
|
+
snippets.join(' | '),
|
93
89
|
e.channel
|
94
90
|
)
|
95
91
|
|
96
|
-
|
92
|
+
send_msg(end_pug_message, e.channel) unless pug.active?
|
97
93
|
end
|
98
94
|
end
|
99
95
|
|
100
96
|
bot.command :kick do |event, *args|
|
101
97
|
setup_pug(event) do |e, pug|
|
102
|
-
return
|
98
|
+
return send_msg(no_active_pug_message, e.channel) unless pug.active?
|
103
99
|
|
104
|
-
args.each do |
|
105
|
-
|
106
|
-
|
100
|
+
args.each do |arg|
|
101
|
+
unless arg.match(/<@!\d+>/)
|
102
|
+
send_msg("#{arg} isn't a valid mention", e.channel)
|
103
|
+
next
|
104
|
+
end
|
107
105
|
|
108
|
-
|
109
|
-
|
110
|
-
"#{display_name} isn't in the PUG",
|
111
|
-
e.channel
|
112
|
-
)
|
106
|
+
user_id = arg[3..-2].to_i
|
107
|
+
display_name = e.display_name_for(user_id) || arg
|
113
108
|
|
109
|
+
unless pug.joined?(user_id)
|
110
|
+
send_msg("#{display_name} isn't in the PUG", e.channel)
|
114
111
|
next
|
115
112
|
end
|
116
113
|
|
117
114
|
pug.leave(user_id)
|
118
115
|
|
119
|
-
|
120
|
-
"#{display_name} is kicked from the PUG
|
116
|
+
snippets = [
|
117
|
+
"#{display_name} is kicked from the PUG",
|
118
|
+
"#{pug.player_slots} remain"
|
119
|
+
]
|
120
|
+
|
121
|
+
snippets << "#{pug.slots_left} more #{pug.notify_roles}" if pug.slots_left == 1
|
122
|
+
|
123
|
+
send_msg(
|
124
|
+
snippets.join(' | '),
|
121
125
|
e.channel
|
122
126
|
)
|
123
127
|
|
124
|
-
break
|
128
|
+
break send_msg(end_pug_message, e.channel) unless pug.active?
|
125
129
|
end
|
126
130
|
end
|
127
131
|
end
|
128
132
|
|
129
133
|
bot.command :end do |event, *args|
|
130
134
|
setup_pug(event) do |e, pug|
|
131
|
-
return
|
135
|
+
return send_msg(no_active_pug_message, e.channel) unless pug.active?
|
132
136
|
|
133
137
|
pug.end_pug
|
134
138
|
|
135
|
-
|
139
|
+
send_msg(end_pug_message, e.channel)
|
136
140
|
end
|
137
141
|
end
|
138
142
|
|
@@ -141,13 +145,13 @@ class QwtfDiscordBotPug # :nodoc:
|
|
141
145
|
roles = args.join(' ')
|
142
146
|
pug.notify_roles = roles
|
143
147
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
148
|
+
msg = if roles.empty?
|
149
|
+
'Notification removed'
|
150
|
+
else
|
151
|
+
"Notification role set to #{roles}"
|
152
|
+
end
|
149
153
|
|
150
|
-
|
154
|
+
send_msg(msg, e.channel)
|
151
155
|
end
|
152
156
|
end
|
153
157
|
|
@@ -164,17 +168,16 @@ class QwtfDiscordBotPug # :nodoc:
|
|
164
168
|
end
|
165
169
|
|
166
170
|
def start_pug(pug, event)
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
)
|
171
|
+
msg = [
|
172
|
+
'Time to play!',
|
173
|
+
['Team 1:', event.mentions_for(pug.team(1)).join(' ')].join(' '),
|
174
|
+
['Team 2:', event.mentions_for(pug.team(2)).join(' ')].join(' ')
|
175
|
+
].join("\n")
|
176
|
+
|
177
|
+
send_msg(msg, event.channel)
|
175
178
|
end
|
176
179
|
|
177
|
-
def
|
180
|
+
def start_pug_send_msg(player_slots:, mentions:)
|
178
181
|
['Time to play!', player_slots, mentions.join(' ')].join(' | ')
|
179
182
|
end
|
180
183
|
|
@@ -186,7 +189,7 @@ class QwtfDiscordBotPug # :nodoc:
|
|
186
189
|
"There's no active PUG"
|
187
190
|
end
|
188
191
|
|
189
|
-
def
|
192
|
+
def send_msg(message, channel)
|
190
193
|
channel.send_message(message) && puts(message)
|
191
194
|
end
|
192
195
|
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: 5.1.
|
4
|
+
version: 5.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sheldon Johnson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: discordrb
|