grinch 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/lib/cinch.rb +7 -5
- data/lib/cinch/ban.rb +6 -2
- data/lib/cinch/bot.rb +21 -31
- data/lib/cinch/cached_list.rb +2 -0
- data/lib/cinch/callback.rb +2 -0
- data/lib/cinch/channel.rb +43 -44
- data/lib/cinch/channel_list.rb +2 -0
- data/lib/cinch/configuration.rb +8 -6
- data/lib/cinch/configuration/bot.rb +35 -33
- data/lib/cinch/configuration/dcc.rb +4 -2
- data/lib/cinch/configuration/plugins.rb +8 -6
- data/lib/cinch/configuration/sasl.rb +6 -4
- data/lib/cinch/configuration/ssl.rb +7 -5
- data/lib/cinch/configuration/timeouts.rb +4 -2
- data/lib/cinch/constants.rb +3 -1
- data/lib/cinch/dcc.rb +2 -0
- data/lib/cinch/dcc/dccable_object.rb +6 -8
- data/lib/cinch/dcc/incoming.rb +2 -0
- data/lib/cinch/dcc/incoming/send.rb +10 -8
- data/lib/cinch/dcc/outgoing.rb +2 -0
- data/lib/cinch/dcc/outgoing/send.rb +13 -14
- data/lib/cinch/exceptions.rb +2 -0
- data/lib/cinch/formatting.rb +32 -30
- data/lib/cinch/handler.rb +15 -13
- data/lib/cinch/handler_list.rb +13 -13
- data/lib/cinch/helpers.rb +16 -16
- data/lib/cinch/irc.rb +118 -142
- data/lib/cinch/isupport.rb +22 -20
- data/lib/cinch/log_filter.rb +3 -2
- data/lib/cinch/logger.rb +7 -2
- data/lib/cinch/logger/formatted_logger.rb +17 -13
- data/lib/cinch/logger/zcbot_logger.rb +4 -0
- data/lib/cinch/logger_list.rb +15 -14
- data/lib/cinch/mask.rb +11 -9
- data/lib/cinch/message.rb +6 -6
- data/lib/cinch/message_queue.rb +5 -4
- data/lib/cinch/mode_parser.rb +7 -5
- data/lib/cinch/network.rb +2 -0
- data/lib/cinch/open_ended_queue.rb +5 -5
- data/lib/cinch/pattern.rb +11 -8
- data/lib/cinch/plugin.rb +43 -49
- data/lib/cinch/plugin_list.rb +4 -4
- data/lib/cinch/rubyext/float.rb +3 -3
- data/lib/cinch/rubyext/module.rb +2 -0
- data/lib/cinch/rubyext/string.rb +8 -6
- data/lib/cinch/sasl.rb +2 -0
- data/lib/cinch/sasl/dh_blowfish.rb +5 -3
- data/lib/cinch/sasl/diffie_hellman.rb +6 -3
- data/lib/cinch/sasl/mechanism.rb +2 -0
- data/lib/cinch/sasl/plain.rb +2 -0
- data/lib/cinch/syncable.rb +10 -9
- data/lib/cinch/target.rb +15 -17
- data/lib/cinch/timer.rb +9 -7
- data/lib/cinch/user.rb +52 -48
- data/lib/cinch/user_list.rb +8 -11
- data/lib/cinch/utilities/deprecation.rb +5 -5
- data/lib/cinch/utilities/encoding.rb +9 -9
- data/lib/cinch/utilities/kernel.rb +4 -1
- data/lib/cinch/version.rb +3 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff1fe47fa67c86ef5ffa119522fa4ae6f9196a190a2a6ebc06a0a4092c4aa0cc
|
4
|
+
data.tar.gz: dc959561efa0b7308b136b12faaeb7ef1cc9740a90c624ef1109f4bfb0899806
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0daf1149621659966dff2f012dc9f0cb156dd9cf381620715e67007e9aca65d83c01170e6d876a7deb9a8501571b6aa3cf7ea6a89ab47be09c015c67e303fa18
|
7
|
+
data.tar.gz: 2705dad2d060be73599612208455b70aecce4c22eef3f230090ca829964313549d2e232ea86ecef980e5804da062c5a94330640a501bf44b6a0ad2f1c8c8a038
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
Grinch - The IRC Bot Building Framework
|
2
2
|
=====================================
|
3
3
|
|
4
|
+
[![Build Status](https://travis-ci.org/grinchrb/grinch.svg?branch=master)](https://travis-ci.org/grinchrb/grinch)
|
5
|
+
|
4
6
|
**WARNING!**
|
5
7
|
|
6
8
|
Grinch is a *lightly* maintained fork of [Cinch](https://github.com/cinchrb/cinch/), which
|
@@ -172,8 +174,8 @@ is missing that awesome jaw-dropping feature and you want to be the one to
|
|
172
174
|
make this magic happen, you can!
|
173
175
|
|
174
176
|
Please note that although we very much appreciate all of your efforts, Grinch
|
175
|
-
will not accept patches in aid of Ruby
|
176
|
-
of supporting Ruby versions below
|
177
|
+
will not accept patches in aid of Ruby 2.5 compatibility. We have no intention
|
178
|
+
of supporting Ruby versions below 2.5.
|
177
179
|
|
178
180
|
Fork the project, implement your awesome feature in its own branch, and send
|
179
181
|
a pull request to one of the Grinch collaborators. We'll be more than happy
|
data/lib/cinch.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "cinch/version"
|
4
|
+
require "cinch/utilities/kernel"
|
5
|
+
require "cinch/utilities/deprecation"
|
6
|
+
require "cinch/utilities/encoding"
|
7
|
+
require "cinch/bot"
|
data/lib/cinch/ban.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "cinch/mask"
|
2
4
|
module Cinch
|
3
5
|
# This class represents channel bans.
|
@@ -23,7 +25,8 @@ module Cinch
|
|
23
25
|
# @param [User, nil] by The user who created the ban.
|
24
26
|
# @param [Time] at The time at which the ban was created
|
25
27
|
def initialize(mask, by, at)
|
26
|
-
@by
|
28
|
+
@by = by
|
29
|
+
@created_at = at
|
27
30
|
if mask =~ /^[\$~]/
|
28
31
|
@extended = true
|
29
32
|
@mask = mask
|
@@ -38,9 +41,10 @@ module Cinch
|
|
38
41
|
# Freenode's extended bans
|
39
42
|
def match(user)
|
40
43
|
raise UnsupportedFeature, "extended bans are not supported yet" if @extended
|
44
|
+
|
41
45
|
@mask =~ user
|
42
46
|
end
|
43
|
-
|
47
|
+
alias =~ match
|
44
48
|
|
45
49
|
# @return [String]
|
46
50
|
def to_s
|
data/lib/cinch/bot.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
require "
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "socket"
|
4
4
|
require "ostruct"
|
5
5
|
require "cinch/rubyext/module"
|
6
6
|
require "cinch/rubyext/string"
|
@@ -56,7 +56,6 @@ module Cinch
|
|
56
56
|
class Bot < User
|
57
57
|
include Helpers
|
58
58
|
|
59
|
-
|
60
59
|
# @return [Configuration::Bot]
|
61
60
|
# @version 2.0.0
|
62
61
|
attr_reader :config
|
@@ -200,10 +199,10 @@ module Cinch
|
|
200
199
|
end
|
201
200
|
end
|
202
201
|
|
203
|
-
handler = Handler.new(self, event, pattern, {args: args, execute_in_callback: true}, &block)
|
202
|
+
handler = Handler.new(self, event, pattern, { args: args, execute_in_callback: true }, &block)
|
204
203
|
@handlers.register(handler)
|
205
204
|
|
206
|
-
|
205
|
+
handler
|
207
206
|
end
|
208
207
|
|
209
208
|
# @endgroup
|
@@ -244,26 +243,24 @@ module Cinch
|
|
244
243
|
user.unsync_all
|
245
244
|
end # reset state of all users
|
246
245
|
|
247
|
-
@channel_list.each
|
248
|
-
channel.unsync_all
|
249
|
-
end # reset state of all channels
|
246
|
+
@channel_list.each(&:unsync_all) # reset state of all channels
|
250
247
|
|
251
248
|
@channels = [] # reset list of channels the bot is in
|
252
249
|
|
253
|
-
@join_handler
|
254
|
-
@join_timer
|
250
|
+
@join_handler&.unregister
|
251
|
+
@join_timer&.stop
|
255
252
|
|
256
|
-
join_lambda =
|
253
|
+
join_lambda = -> { @config.channels.each { |channel| Channel(channel).join } }
|
257
254
|
|
258
255
|
if @config.delay_joins.is_a?(Symbol)
|
259
|
-
@join_handler = join_handler = on(@config.delay_joins)
|
256
|
+
@join_handler = join_handler = on(@config.delay_joins) do
|
260
257
|
join_handler.unregister
|
261
258
|
join_lambda.call
|
262
|
-
|
259
|
+
end
|
263
260
|
else
|
264
|
-
@join_timer = Timer.new(self, interval: @config.delay_joins, shots: 1)
|
261
|
+
@join_timer = Timer.new(self, interval: @config.delay_joins, shots: 1) do
|
265
262
|
join_lambda.call
|
266
|
-
|
263
|
+
end
|
267
264
|
end
|
268
265
|
|
269
266
|
@modes = []
|
@@ -286,11 +283,9 @@ module Cinch
|
|
286
283
|
wait = @config.max_reconnect_delay if wait > @config.max_reconnect_delay
|
287
284
|
@loggers.info "Waiting #{wait} seconds before reconnecting"
|
288
285
|
start_time = Time.now
|
289
|
-
while !@quitting && (Time.now - start_time) < wait
|
290
|
-
sleep 1
|
291
|
-
end
|
286
|
+
sleep 1 while !@quitting && (Time.now - start_time) < wait
|
292
287
|
end
|
293
|
-
end while @config.reconnect
|
288
|
+
end while @config.reconnect && !@quitting
|
294
289
|
end
|
295
290
|
|
296
291
|
# @endgroup
|
@@ -332,11 +327,11 @@ module Cinch
|
|
332
327
|
|
333
328
|
# @yield
|
334
329
|
def initialize(&b)
|
335
|
-
@config
|
330
|
+
@config = Configuration::Bot.new
|
336
331
|
|
337
332
|
@loggers = LoggerList.new
|
338
333
|
@loggers << Logger::FormattedLogger.new($stderr, level: @config.default_logger_level)
|
339
|
-
@handlers
|
334
|
+
@handlers = HandlerList.new
|
340
335
|
@semaphores_mutex = Mutex.new
|
341
336
|
@semaphores = Hash.new { |h, k| h[k] = Mutex.new }
|
342
337
|
@callback = Callback.new(self)
|
@@ -419,9 +414,8 @@ module Cinch
|
|
419
414
|
end
|
420
415
|
|
421
416
|
def nick=(new_nick)
|
422
|
-
if new_nick.size > @irc.isupport["NICKLEN"] && strict?
|
423
|
-
|
424
|
-
end
|
417
|
+
raise Exceptions::NickTooLong, new_nick if new_nick.size > @irc.isupport["NICKLEN"] && strict?
|
418
|
+
|
425
419
|
@config.nick = new_nick
|
426
420
|
@irc.send "NICK #{new_nick}"
|
427
421
|
end
|
@@ -434,7 +428,7 @@ module Cinch
|
|
434
428
|
# @since 2.1.0
|
435
429
|
# @return [void]
|
436
430
|
def oper(password, user = nil)
|
437
|
-
user ||=
|
431
|
+
user ||= nick
|
438
432
|
@irc.send "OPER #{user} #{password}"
|
439
433
|
end
|
440
434
|
|
@@ -457,11 +451,7 @@ module Cinch
|
|
457
451
|
# if we have a base, try the next nick or append an
|
458
452
|
# underscore if no more nicks are left
|
459
453
|
new_index = nicks.index(base) + 1
|
460
|
-
|
461
|
-
new_nick = nicks[new_index]
|
462
|
-
else
|
463
|
-
new_nick = base + "_"
|
464
|
-
end
|
454
|
+
new_nick = nicks[new_index] || base + "_"
|
465
455
|
end
|
466
456
|
else
|
467
457
|
# if we have no base, try the first possible nick
|
data/lib/cinch/cached_list.rb
CHANGED
data/lib/cinch/callback.rb
CHANGED
data/lib/cinch/channel.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "set"
|
3
4
|
require "cinch/target"
|
4
5
|
|
@@ -49,24 +50,24 @@ module Cinch
|
|
49
50
|
def initialize(name, bot)
|
50
51
|
@bot = bot
|
51
52
|
@name = name
|
52
|
-
@users = Hash.new {|h, k| h[k] = []}
|
53
|
+
@users = Hash.new { |h, k| h[k] = [] }
|
53
54
|
@bans = []
|
54
55
|
@owners = []
|
55
56
|
|
56
57
|
@modes = {}
|
57
|
-
# TODO raise if not a channel
|
58
|
+
# TODO: raise if not a channel
|
58
59
|
|
59
60
|
@topic = nil
|
60
61
|
|
61
62
|
@in_channel = false
|
62
63
|
|
63
|
-
@synced_attributes
|
64
|
-
@when_requesting_synced_attribute = lambda {|attr|
|
64
|
+
@synced_attributes = Set.new
|
65
|
+
@when_requesting_synced_attribute = lambda { |attr|
|
65
66
|
if @in_channel && attr == :topic && !attribute_synced?(:topic)
|
66
67
|
# Even if we are in the channel, if there's no topic set,
|
67
68
|
# the attribute won't be synchronised yet. Explicitly
|
68
69
|
# request the topic.
|
69
|
-
@bot.irc.send "TOPIC
|
70
|
+
@bot.irc.send "TOPIC #{@name}"
|
70
71
|
next
|
71
72
|
end
|
72
73
|
|
@@ -74,21 +75,21 @@ module Cinch
|
|
74
75
|
unsync(attr)
|
75
76
|
case attr
|
76
77
|
when :users
|
77
|
-
@bot.irc.send "NAMES
|
78
|
+
@bot.irc.send "NAMES #{@name}"
|
78
79
|
when :topic
|
79
|
-
@bot.irc.send "TOPIC
|
80
|
+
@bot.irc.send "TOPIC #{@name}"
|
80
81
|
when :bans
|
81
|
-
@bot.irc.send "MODE
|
82
|
+
@bot.irc.send "MODE #{@name} +b"
|
82
83
|
when :owners
|
83
84
|
if @bot.irc.network.owner_list_mode
|
84
|
-
@bot.irc.send "MODE
|
85
|
+
@bot.irc.send "MODE #{@name} +#{@bot.irc.network.owner_list_mode}"
|
85
86
|
else
|
86
87
|
# the current IRCd does not support channel owners, so
|
87
88
|
# just mark the empty array as synced
|
88
89
|
mark_as_synced(:owners)
|
89
90
|
end
|
90
91
|
when :modes
|
91
|
-
@bot.irc.send "MODE
|
92
|
+
@bot.irc.send "MODE #{@name}"
|
92
93
|
end
|
93
94
|
end
|
94
95
|
}
|
@@ -101,7 +102,7 @@ module Cinch
|
|
101
102
|
# @since 1.1.0
|
102
103
|
# @version 1.1.2
|
103
104
|
def has_user?(user)
|
104
|
-
@users.
|
105
|
+
@users.key?(User(user))
|
105
106
|
end
|
106
107
|
|
107
108
|
# @return [Boolean] true if `user` is opped in the channel
|
@@ -128,25 +129,25 @@ module Cinch
|
|
128
129
|
# @return [Array<User>] All ops in the channel
|
129
130
|
# @since 2.0.0
|
130
131
|
def ops
|
131
|
-
@users.select {|
|
132
|
+
@users.select { |_user, modes| modes.include?("o") }.keys
|
132
133
|
end
|
133
134
|
|
134
135
|
# @return [Array<User>] All half-ops in the channel
|
135
136
|
# @since 2.0.0
|
136
137
|
def half_ops
|
137
|
-
@users.select {|
|
138
|
+
@users.select { |_user, modes| modes.include?("h") }.keys
|
138
139
|
end
|
139
140
|
|
140
141
|
# @return [Array<User>] All voiced users in the channel
|
141
142
|
# @since 2.0.0
|
142
143
|
def voiced
|
143
|
-
@users.select {|
|
144
|
+
@users.select { |_user, modes| modes.include?("v") }.keys
|
144
145
|
end
|
145
146
|
|
146
147
|
# @return [Array<User>] All admins in the channel
|
147
148
|
# @since 2.0.0
|
148
149
|
def admins
|
149
|
-
@users.select {|
|
150
|
+
@users.select { |_user, modes| modes.include?("a") }.keys
|
150
151
|
end
|
151
152
|
# @endgroup
|
152
153
|
|
@@ -157,7 +158,7 @@ module Cinch
|
|
157
158
|
end
|
158
159
|
|
159
160
|
def limit=(val)
|
160
|
-
if val == -1
|
161
|
+
if (val == -1) || val.nil?
|
161
162
|
mode "-l"
|
162
163
|
else
|
163
164
|
mode "+l #{val}"
|
@@ -168,7 +169,7 @@ module Cinch
|
|
168
169
|
def secret
|
169
170
|
@modes["s"]
|
170
171
|
end
|
171
|
-
|
172
|
+
alias secret? secret
|
172
173
|
|
173
174
|
def secret=(bool)
|
174
175
|
if bool
|
@@ -182,7 +183,7 @@ module Cinch
|
|
182
183
|
def moderated
|
183
184
|
@modes["m"]
|
184
185
|
end
|
185
|
-
|
186
|
+
alias moderated? moderated
|
186
187
|
|
187
188
|
def moderated=(bool)
|
188
189
|
if bool
|
@@ -196,7 +197,7 @@ module Cinch
|
|
196
197
|
def invite_only
|
197
198
|
@modes["i"]
|
198
199
|
end
|
199
|
-
|
200
|
+
alias invite_only? invite_only
|
200
201
|
|
201
202
|
def invite_only=(bool)
|
202
203
|
if bool
|
@@ -228,14 +229,14 @@ module Cinch
|
|
228
229
|
unsync :owners
|
229
230
|
|
230
231
|
if @bot.irc.isupport["WHOX"]
|
231
|
-
@bot.irc.send "WHO
|
232
|
+
@bot.irc.send "WHO #{@name} %acfhnru"
|
232
233
|
else
|
233
|
-
@bot.irc.send "WHO
|
234
|
+
@bot.irc.send "WHO #{@name}"
|
234
235
|
end
|
235
|
-
@bot.irc.send "MODE
|
236
|
-
@bot.irc.send "MODE
|
236
|
+
@bot.irc.send "MODE #{@name} +b" # bans
|
237
|
+
@bot.irc.send "MODE #{@name}"
|
237
238
|
if @bot.irc.network.owner_list_mode
|
238
|
-
@bot.irc.send "MODE
|
239
|
+
@bot.irc.send "MODE #{@name} +#{@bot.irc.network.owner_list_mode}"
|
239
240
|
else
|
240
241
|
mark_as_synced :owners
|
241
242
|
end
|
@@ -251,7 +252,7 @@ module Cinch
|
|
251
252
|
def ban(target)
|
252
253
|
mask = Mask.from(target)
|
253
254
|
|
254
|
-
@bot.irc.send "MODE
|
255
|
+
@bot.irc.send "MODE #{@name} +b #{mask}"
|
255
256
|
mask
|
256
257
|
end
|
257
258
|
|
@@ -263,7 +264,7 @@ module Cinch
|
|
263
264
|
def unban(target)
|
264
265
|
mask = Mask.from(target)
|
265
266
|
|
266
|
-
@bot.irc.send "MODE
|
267
|
+
@bot.irc.send "MODE #{@name} -b #{mask}"
|
267
268
|
mask
|
268
269
|
end
|
269
270
|
|
@@ -272,7 +273,7 @@ module Cinch
|
|
272
273
|
# @param [String, User] user the user to op
|
273
274
|
# @return [void]
|
274
275
|
def op(user)
|
275
|
-
@bot.irc.send "MODE
|
276
|
+
@bot.irc.send "MODE #{@name} +o #{user}"
|
276
277
|
end
|
277
278
|
|
278
279
|
# Deops a user.
|
@@ -280,7 +281,7 @@ module Cinch
|
|
280
281
|
# @param [String, User] user the user to deop
|
281
282
|
# @return [void]
|
282
283
|
def deop(user)
|
283
|
-
@bot.irc.send "MODE
|
284
|
+
@bot.irc.send "MODE #{@name} -o #{user}"
|
284
285
|
end
|
285
286
|
|
286
287
|
# Voices a user.
|
@@ -288,7 +289,7 @@ module Cinch
|
|
288
289
|
# @param [String, User] user the user to voice
|
289
290
|
# @return [void]
|
290
291
|
def voice(user)
|
291
|
-
@bot.irc.send "MODE
|
292
|
+
@bot.irc.send "MODE #{@name} +v #{user}"
|
292
293
|
end
|
293
294
|
|
294
295
|
# Devoices a user.
|
@@ -296,7 +297,7 @@ module Cinch
|
|
296
297
|
# @param [String, User] user the user to devoice
|
297
298
|
# @return [void]
|
298
299
|
def devoice(user)
|
299
|
-
@bot.irc.send "MODE
|
300
|
+
@bot.irc.send "MODE #{@name} -v #{user}"
|
300
301
|
end
|
301
302
|
|
302
303
|
# Invites a user to the channel.
|
@@ -304,7 +305,7 @@ module Cinch
|
|
304
305
|
# @param [String, User] user the user to invite
|
305
306
|
# @return [void]
|
306
307
|
def invite(user)
|
307
|
-
@bot.irc.send("INVITE #{user}
|
308
|
+
@bot.irc.send("INVITE #{user} #{@name}")
|
308
309
|
end
|
309
310
|
|
310
311
|
undef_method(:topic=)
|
@@ -318,7 +319,7 @@ module Cinch
|
|
318
319
|
raise Exceptions::TopicTooLong, new_topic
|
319
320
|
end
|
320
321
|
|
321
|
-
@bot.irc.send "TOPIC
|
322
|
+
@bot.irc.send "TOPIC #{@name} :#{new_topic}"
|
322
323
|
end
|
323
324
|
|
324
325
|
# Kicks a user from the channel.
|
@@ -332,7 +333,7 @@ module Cinch
|
|
332
333
|
raise Exceptions::KickReasonTooLong, reason
|
333
334
|
end
|
334
335
|
|
335
|
-
@bot.irc.send("KICK
|
336
|
+
@bot.irc.send("KICK #{@name} #{user} :#{reason}")
|
336
337
|
end
|
337
338
|
|
338
339
|
# Removes a user from the channel.
|
@@ -347,7 +348,7 @@ module Cinch
|
|
347
348
|
# @param [String] reason a reason for the removal
|
348
349
|
# @return [void]
|
349
350
|
def remove(user, reason = nil)
|
350
|
-
@bot.irc.send("REMOVE
|
351
|
+
@bot.irc.send("REMOVE #{@name} #{user} :#{reason}")
|
351
352
|
end
|
352
353
|
|
353
354
|
# Sets or unsets modes. Most of the time you won't need this but
|
@@ -358,7 +359,7 @@ module Cinch
|
|
358
359
|
# @example
|
359
360
|
# channel.mode "+n"
|
360
361
|
def mode(s)
|
361
|
-
@bot.irc.send "MODE
|
362
|
+
@bot.irc.send "MODE #{@name} #{s}"
|
362
363
|
end
|
363
364
|
|
364
365
|
# Causes the bot to part from the channel.
|
@@ -366,7 +367,7 @@ module Cinch
|
|
366
367
|
# @param [String] message the part message.
|
367
368
|
# @return [void]
|
368
369
|
def part(message = nil)
|
369
|
-
@bot.irc.send "PART
|
370
|
+
@bot.irc.send "PART #{@name} :#{message}"
|
370
371
|
end
|
371
372
|
|
372
373
|
# Joins the channel
|
@@ -375,9 +376,7 @@ module Cinch
|
|
375
376
|
# specified but @key is set, @key will be used
|
376
377
|
# @return [void]
|
377
378
|
def join(key = nil)
|
378
|
-
if key.nil?
|
379
|
-
key = self.key
|
380
|
-
end
|
379
|
+
key = self.key if key.nil? && (self.key != true)
|
381
380
|
@bot.irc.send "JOIN #{[@name, key].compact.join(" ")}"
|
382
381
|
end
|
383
382
|
|
@@ -409,7 +408,7 @@ module Cinch
|
|
409
408
|
# @note The aliases `msg` and `privmsg` are deprecated and will be
|
410
409
|
# removed in a future version.
|
411
410
|
def send(text, notice = false)
|
412
|
-
# TODO deprecate 'notice' argument
|
411
|
+
# TODO: deprecate 'notice' argument
|
413
412
|
text = text.to_s
|
414
413
|
if @modes["c"]
|
415
414
|
# Remove all formatting and colors if the channel doesn't
|
@@ -418,8 +417,8 @@ module Cinch
|
|
418
417
|
end
|
419
418
|
super(text, notice)
|
420
419
|
end
|
421
|
-
|
422
|
-
|
420
|
+
alias msg send # deprecated
|
421
|
+
alias privmsg send # deprecated
|
423
422
|
undef_method(:msg) # yardoc hack
|
424
423
|
undef_method(:privmsg) # yardoc hack
|
425
424
|
|
@@ -447,7 +446,7 @@ module Cinch
|
|
447
446
|
def to_s
|
448
447
|
@name
|
449
448
|
end
|
450
|
-
|
449
|
+
alias to_str to_s # deprecated
|
451
450
|
undef_method(:to_str) # yardoc hack
|
452
451
|
|
453
452
|
def to_str
|