kag-gather 1.2.0 → 1.2.1
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.
- data/lib/kag/bot.rb +5 -0
- data/lib/kag/gather.rb +35 -6
- data/lib/kag/version.rb +1 -1
- metadata +1 -1
data/lib/kag/bot.rb
CHANGED
@@ -15,7 +15,12 @@ module KAG
|
|
15
15
|
c.nick = config[:nick].to_s != "" ? config[:nick] : "KAGatherer"
|
16
16
|
c.realname = config[:realname].to_s != "" ? config[:realname] : "KAG Gatherer"
|
17
17
|
c.messages_per_second = 1
|
18
|
+
c.server_queue_size = 1
|
18
19
|
c.plugins.plugins = [KAG::Gather]
|
20
|
+
if config[:sasl]
|
21
|
+
c.sasl.username = config[:sasl][:username]
|
22
|
+
c.sasl.password = config[:sasl][:password]
|
23
|
+
end
|
19
24
|
end
|
20
25
|
end
|
21
26
|
|
data/lib/kag/gather.rb
CHANGED
@@ -65,8 +65,10 @@ module KAG
|
|
65
65
|
if match
|
66
66
|
match.remove_player(m.user.nick)
|
67
67
|
send_channels_msg "#{nick} has left the match at #{match.server[:key]}! Find a sub!"
|
68
|
-
elsif @queue.key?(user)
|
69
|
-
remove_user_from_queue(m.user.nick)
|
68
|
+
elsif @queue.key?(m.user.nick)
|
69
|
+
unless remove_user_from_queue(m.user.nick)
|
70
|
+
debug "#{nick} is not in the queue."
|
71
|
+
end
|
70
72
|
end
|
71
73
|
end
|
72
74
|
|
@@ -101,7 +103,7 @@ module KAG
|
|
101
103
|
end
|
102
104
|
end
|
103
105
|
|
104
|
-
def add_user_to_queue(m,nick)
|
106
|
+
def add_user_to_queue(m,nick,send_msg = true)
|
105
107
|
unless @queue.key?(nick) or get_match_in(nick)
|
106
108
|
@queue[nick] = SymbolTable.new({
|
107
109
|
:user => User(nick),
|
@@ -109,15 +111,18 @@ module KAG
|
|
109
111
|
:message => m.message,
|
110
112
|
:joined_at => Time.now
|
111
113
|
})
|
112
|
-
send_channels_msg "Added #{nick} to queue (#{KAG::Match.type_as_string}) [#{@queue.length}]"
|
114
|
+
send_channels_msg "Added #{nick} to queue (#{KAG::Match.type_as_string}) [#{@queue.length}]" if send_msg
|
113
115
|
check_for_new_match
|
114
116
|
end
|
115
117
|
end
|
116
118
|
|
117
|
-
def remove_user_from_queue(nick)
|
119
|
+
def remove_user_from_queue(nick,send_msg = true)
|
118
120
|
if @queue.key?(nick)
|
119
121
|
@queue.delete(nick)
|
120
|
-
send_channels_msg "Removed #{nick} from queue (#{KAG::Match.type_as_string}) [#{@queue.length}]"
|
122
|
+
send_channels_msg "Removed #{nick} from queue (#{KAG::Match.type_as_string}) [#{@queue.length}]" if send_msg
|
123
|
+
true
|
124
|
+
else
|
125
|
+
false
|
121
126
|
end
|
122
127
|
end
|
123
128
|
|
@@ -221,6 +226,16 @@ module KAG
|
|
221
226
|
end
|
222
227
|
end
|
223
228
|
|
229
|
+
match /rem_silent (.+)/, method: :evt_rem_silent_admin
|
230
|
+
def evt_rem_silent_admin(m, arg)
|
231
|
+
if is_admin(m.user)
|
232
|
+
arg = arg.split(" ")
|
233
|
+
arg.each do |nick|
|
234
|
+
remove_user_from_queue(nick,false)
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
224
239
|
match /add (.+)/, method: :evt_add_admin
|
225
240
|
def evt_add_admin(m, arg)
|
226
241
|
if is_admin(m.user)
|
@@ -235,6 +250,20 @@ module KAG
|
|
235
250
|
end
|
236
251
|
end
|
237
252
|
|
253
|
+
match /add_silent (.+)/, method: :evt_add_silent_admin
|
254
|
+
def evt_add_silent_admin(m, arg)
|
255
|
+
if is_admin(m.user)
|
256
|
+
arg = arg.split(" ")
|
257
|
+
arg.each do |nick|
|
258
|
+
if m.channel.has_user?(nick)
|
259
|
+
add_user_to_queue(m,nick,false)
|
260
|
+
else
|
261
|
+
reply m,"User #{nick} is not in this channel!"
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
238
267
|
match /is_admin (.+)/, method: :evt_am_i_admin
|
239
268
|
def evt_am_i_admin(m,nick)
|
240
269
|
u = User(nick)
|
data/lib/kag/version.rb
CHANGED