ircinch 2.4.4 → 2.4.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/.standard.yml +1 -1
- data/CHANGELOG.md +13 -0
- data/CODE_OF_CONDUCT.md +7 -81
- data/README.md +39 -30
- data/docs/bot_options.md +207 -314
- data/docs/changes.md +293 -282
- data/docs/common_mistakes.md +50 -41
- data/docs/common_tasks.md +63 -42
- data/docs/encodings.md +28 -55
- data/docs/events.md +123 -131
- data/docs/getting_started.md +97 -102
- data/docs/logging.md +62 -70
- data/docs/migrating.md +145 -131
- data/docs/plugins.md +109 -3
- data/docs/readme.md +17 -15
- data/examples/README.md +78 -0
- data/examples/basic/autovoice.rb +14 -18
- data/examples/basic/google.rb +9 -22
- data/examples/basic/hello.rb +4 -3
- data/examples/basic/join_part.rb +8 -23
- data/examples/basic/memo.rb +26 -24
- data/examples/basic/msg.rb +6 -6
- data/examples/basic/seen.rb +17 -24
- data/examples/basic/urban_dict.rb +6 -26
- data/examples/basic/url_shorten.rb +8 -26
- data/examples/plugins/autovoice.rb +17 -16
- data/examples/plugins/custom_prefix.rb +4 -3
- data/examples/plugins/dice_roll.rb +13 -20
- data/examples/plugins/google.rb +7 -21
- data/examples/plugins/hello.rb +4 -3
- data/examples/plugins/hooks.rb +5 -6
- data/examples/plugins/join_part.rb +8 -21
- data/examples/plugins/lambdas.rb +5 -6
- data/examples/plugins/last_nick.rb +7 -6
- data/examples/plugins/msg.rb +6 -6
- data/examples/plugins/multiple_matches.rb +10 -11
- data/examples/plugins/own_events.rb +14 -19
- data/examples/plugins/seen.rb +23 -23
- data/examples/plugins/timer.rb +5 -6
- data/examples/plugins/url_shorten.rb +15 -19
- data/examples/settings.rb +19 -0
- data/examples/tiny_url.rb +41 -0
- data/ircinch.gemspec +5 -6
- data/lib/cinch/bot.rb +2 -3
- data/lib/cinch/channel.rb +4 -4
- data/lib/cinch/irc.rb +2 -2
- data/lib/cinch/message_queue.rb +2 -2
- data/lib/cinch/plugin.rb +1 -1
- data/lib/cinch/version.rb +1 -1
- metadata +270 -249
- data/lib/cinch/rubyext/float.rb +0 -5
data/docs/changes.md
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
#
|
|
2
|
-
# @markup kramdown
|
|
1
|
+
# Historical Cinch Changelog
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
These release notes describe the original Cinch 1.1–2.2 releases. See the
|
|
4
|
+
[IRCinch Changelog](../CHANGELOG.md) for later releases and the
|
|
5
|
+
[documentation index](readme.md) for current usage.
|
|
5
6
|
|
|
6
|
-
##
|
|
7
|
+
## What has changed in 2.2?
|
|
8
|
+
|
|
9
|
+
### Getting rid of CP1252 in favour of UTF-8
|
|
7
10
|
|
|
8
11
|
In versions before 2.2, when using the `irc` encoding (the default),
|
|
9
12
|
Cinch would use CP1252 for outgoing messages, only falling back to
|
|
@@ -17,39 +20,40 @@ than there are clients that can deal with this hybrid encoding, or
|
|
|
17
20
|
CP1252 itself. That's why, from now on, we will always use UTF-8.
|
|
18
21
|
|
|
19
22
|
If you depend on outgoing messages being encoded in CP1252, please see
|
|
20
|
-
|
|
23
|
+
[Encodings](encodings.md) on how to change the encoding.
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
### API improvements
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
#### New methods
|
|
25
28
|
|
|
26
|
-
-
|
|
29
|
+
- [`Cinch::Channel#remove`](../lib/cinch/channel.rb) has been added to support the non-standard
|
|
27
30
|
REMOVE command, a friendlier alternative to kicking people.
|
|
28
31
|
|
|
29
|
-
-
|
|
32
|
+
- [`Cinch::Helpers.sanitize`](../lib/cinch/helpers.rb) and [`Cinch::Formatting.unformat`](../lib/cinch/formatting.rb) have been
|
|
30
33
|
added to help with removing unprintable characters and mIRC
|
|
31
34
|
formatting codes from strings.
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
#### Deprecated methods
|
|
34
37
|
|
|
35
38
|
In order to reduce the amount of aliases, the following ones have been
|
|
36
39
|
deprecated and will be removed in a future release:
|
|
37
40
|
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
41
|
+
- [`Cinch::Channel#msg`](../lib/cinch/channel.rb)
|
|
42
|
+
- [`Cinch::Channel#privmsg`](../lib/cinch/channel.rb)
|
|
43
|
+
- [`Cinch::Target#msg`](../lib/cinch/target.rb)
|
|
44
|
+
- [`Cinch::Target#privmsg`](../lib/cinch/target.rb)
|
|
45
|
+
- [`Cinch::Target#safe_msg`](../lib/cinch/target.rb)
|
|
46
|
+
- [`Cinch::Target#safe_privmsg`](../lib/cinch/target.rb)
|
|
47
|
+
- [`Cinch::User#whois`](../lib/cinch/user.rb)
|
|
48
|
+
- [`Cinch::Helpers#Color`](../lib/cinch/helpers.rb)
|
|
46
49
|
|
|
47
50
|
Additionally, the following method is deprecated and will be removed
|
|
48
51
|
in the future:
|
|
49
52
|
|
|
50
|
-
-
|
|
53
|
+
- [`Cinch::Channel#to_str`](../lib/cinch/channel.rb)
|
|
54
|
+
|
|
55
|
+
## What has changed in 2.1?
|
|
51
56
|
|
|
52
|
-
# What has changed in 2.1?
|
|
53
57
|
1. Color stripping
|
|
54
58
|
1. Per group hooks
|
|
55
59
|
1. API improvements
|
|
@@ -57,61 +61,60 @@ in the future:
|
|
|
57
61
|
1. Changed methods
|
|
58
62
|
1. New aliases
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
### Color stripping
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
messages.
|
|
66
|
+
[`Cinch::Formatting.unformat`](../lib/cinch/formatting.rb) removes mIRC color
|
|
67
|
+
codes from messages. It replaces `Cinch::Utilities::String.strip_colors`.
|
|
65
68
|
|
|
66
69
|
Additionally, a new match option called `strip_colors` makes it
|
|
67
70
|
possible to automatically and temporarily strip color codes before
|
|
68
71
|
attempting to match a message.
|
|
69
72
|
|
|
70
|
-
|
|
73
|
+
### Per group hooks
|
|
71
74
|
|
|
72
75
|
A new option `group` for hooks allows registering hooks for specific
|
|
73
76
|
groups.
|
|
74
77
|
|
|
75
|
-
|
|
78
|
+
### API improvements
|
|
76
79
|
|
|
77
|
-
|
|
80
|
+
#### New methods
|
|
78
81
|
|
|
79
|
-
|
|
82
|
+
##### [`Cinch::Bot`](../lib/cinch/bot.rb)
|
|
80
83
|
|
|
81
|
-
-
|
|
84
|
+
- [`Cinch::Bot#oper`](../lib/cinch/bot.rb)
|
|
82
85
|
|
|
83
|
-
|
|
86
|
+
##### [`Cinch::User`](../lib/cinch/user.rb)
|
|
84
87
|
|
|
85
|
-
-
|
|
88
|
+
- [`Cinch::User#oper?`](../lib/cinch/user.rb)
|
|
86
89
|
|
|
87
|
-
|
|
90
|
+
##### [`Cinch::Message`](../lib/cinch/message.rb)
|
|
88
91
|
|
|
89
|
-
-
|
|
90
|
-
-
|
|
92
|
+
- [`Cinch::Message#action_reply`](../lib/cinch/message.rb)
|
|
93
|
+
- [`Cinch::Message#safe_action_reply`](../lib/cinch/message.rb)
|
|
91
94
|
|
|
92
|
-
|
|
95
|
+
#### Changed methods
|
|
93
96
|
|
|
94
|
-
|
|
97
|
+
##### [`Cinch::Handler`](../lib/cinch/handler.rb)
|
|
95
98
|
|
|
96
|
-
-
|
|
99
|
+
- [`Cinch::Handler#call`](../lib/cinch/handler.rb) now returns the started thread.
|
|
97
100
|
|
|
98
|
-
|
|
101
|
+
##### [`Cinch::HandlerList`](../lib/cinch/handler_list.rb)
|
|
99
102
|
|
|
100
|
-
-
|
|
103
|
+
- [`Cinch::HandlerList#dispatch`](../lib/cinch/handler_list.rb) now returns the started threads.
|
|
101
104
|
|
|
102
|
-
|
|
105
|
+
#### New aliases
|
|
103
106
|
|
|
104
107
|
Due to some unfortunate naming mistakes in Cinch 2.0, Cinch 2.1 adds
|
|
105
108
|
several aliases. All of the new aliases deprecate the original method
|
|
106
109
|
names, which will be removed in Cinch 3.0.
|
|
107
110
|
|
|
108
|
-
|
|
109
|
-
- {Cinch::User#monitored?} for {Cinch::User#monitored}
|
|
110
|
-
- {Cinch::User#synced?} for {Cinch::User#synced}
|
|
111
|
+
##### [`Cinch::User`](../lib/cinch/user.rb)
|
|
111
112
|
|
|
113
|
+
- [`Cinch::User#monitored?`](../lib/cinch/user.rb) for [`Cinch::User#monitored`](../lib/cinch/user.rb)
|
|
114
|
+
- [`Cinch::User#synced?`](../lib/cinch/user.rb) for [`Cinch::User#synced`](../lib/cinch/user.rb)
|
|
112
115
|
|
|
116
|
+
## What has changed in 2.0?
|
|
113
117
|
|
|
114
|
-
# What has changed in 2.0?
|
|
115
118
|
1. Added support for SASL
|
|
116
119
|
1. Added support for DCC SEND
|
|
117
120
|
1. Added a fair scheduler for outgoing messages
|
|
@@ -126,7 +129,7 @@ names, which will be removed in Cinch 3.0.
|
|
|
126
129
|
1. Reworked logging facilities
|
|
127
130
|
1. API improvements
|
|
128
131
|
1. Helper changes
|
|
129
|
-
1. Added a Cinch::Target
|
|
132
|
+
1. Added a `Cinch::Target` class
|
|
130
133
|
1. Cinch::Constants
|
|
131
134
|
1. New methods
|
|
132
135
|
1. Removed/Renamed methods
|
|
@@ -136,17 +139,18 @@ names, which will be removed in Cinch 3.0.
|
|
|
136
139
|
1. Renamed `*Manager` to `*List`
|
|
137
140
|
1. New events
|
|
138
141
|
|
|
139
|
-
|
|
142
|
+
### Added support for SASL
|
|
140
143
|
|
|
141
144
|
Cinch now supports authenticating to services via SASL. For more
|
|
142
|
-
information check
|
|
145
|
+
information check [`Cinch::SASL`](../lib/cinch/sasl.rb).
|
|
143
146
|
|
|
144
|
-
|
|
147
|
+
### Added support for DCC SEND
|
|
145
148
|
|
|
146
149
|
Support for sending and receiving files via DCC has been added to
|
|
147
|
-
Cinch. Check
|
|
150
|
+
Cinch. Check [`Cinch::DCC`](../lib/cinch/dcc.rb) for more information.
|
|
151
|
+
|
|
152
|
+
### Added a fair scheduler for outgoing messages
|
|
148
153
|
|
|
149
|
-
## Added a fair scheduler for outgoing messages
|
|
150
154
|
Cinch always provided sophisticated throttling to avoid getting kicked
|
|
151
155
|
due to _excess flood_. One major flaw, however, was that it used a
|
|
152
156
|
single FIFO for all messages, thus preferring early message targets
|
|
@@ -155,7 +159,7 @@ and penalizing later ones.
|
|
|
155
159
|
Now Cinch uses a round-robin approach, having one queue per message
|
|
156
160
|
target (channels and users) and one for generic commands.
|
|
157
161
|
|
|
158
|
-
|
|
162
|
+
### Added required plugin options
|
|
159
163
|
|
|
160
164
|
Plugins can now require specific options to be set. If any of those
|
|
161
165
|
options are not set, the plugin will automatically refuse being
|
|
@@ -165,49 +169,50 @@ This is useful for example for plugins that require API keys to
|
|
|
165
169
|
interact with web services.
|
|
166
170
|
|
|
167
171
|
The new attribute is called
|
|
168
|
-
|
|
172
|
+
[`required_options`](../lib/cinch/plugin.rb).
|
|
169
173
|
|
|
170
174
|
Example:
|
|
171
175
|
|
|
172
|
-
|
|
173
|
-
|
|
176
|
+
```ruby
|
|
177
|
+
class MyPlugin
|
|
178
|
+
include Cinch::Plugin
|
|
174
179
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
180
|
+
set :required_options, [:foo, :bar]
|
|
181
|
+
# ...
|
|
182
|
+
end
|
|
178
183
|
|
|
179
|
-
|
|
184
|
+
# ...
|
|
180
185
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
186
|
+
bot.configure do |c|
|
|
187
|
+
c.plugins.plugins = [MyPlugin]
|
|
188
|
+
c.plugins.options[MyPlugin] = {:foo => 1}
|
|
189
|
+
end
|
|
185
190
|
|
|
186
|
-
|
|
187
|
-
|
|
191
|
+
# The plugin won't load because the option :bar is not set.
|
|
192
|
+
# Instead it will print a warning.
|
|
193
|
+
```
|
|
188
194
|
|
|
189
|
-
|
|
195
|
+
### Added support for colors/formatting
|
|
190
196
|
|
|
191
|
-
A new
|
|
197
|
+
A new [module](../lib/cinch/formatting.rb) and [`helper`](../lib/cinch/helpers.rb)
|
|
192
198
|
for adding colors and formatting to messages has been added. See the
|
|
193
|
-
|
|
199
|
+
[module's documentation](../lib/cinch/formatting.rb) for more information on
|
|
194
200
|
usage.
|
|
195
201
|
|
|
196
|
-
|
|
202
|
+
### Added support for network discovery
|
|
197
203
|
|
|
198
204
|
Cinch now tries to detect the network it connects to, including the
|
|
199
205
|
running IRCd. For most parts this is only interesting internally, but
|
|
200
206
|
if you're writing advanced plugins that hook directly into IRC and
|
|
201
207
|
needs to be aware of available features/quirks, check out
|
|
202
|
-
|
|
208
|
+
[`Cinch::IRC#network`](../lib/cinch/irc.rb) and [`Cinch::Network`](../lib/cinch/network.rb).
|
|
203
209
|
|
|
204
|
-
|
|
210
|
+
### Reworked logging facilities
|
|
205
211
|
|
|
206
212
|
The logging API has been drastically improved. Check the
|
|
207
|
-
|
|
208
|
-
|
|
213
|
+
[logging documentation](logging.md) for more information.
|
|
209
214
|
|
|
210
|
-
|
|
215
|
+
### Added match groups
|
|
211
216
|
|
|
212
217
|
A new option for matchers, `:group`, allows grouping multiple matchers
|
|
213
218
|
to a group. What's special is that in any group, only the first
|
|
@@ -215,177 +220,178 @@ matching handler will be executed.
|
|
|
215
220
|
|
|
216
221
|
Example:
|
|
217
222
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
match /foo (\d+)/, group: :blegh, method: :foo1
|
|
222
|
-
match /foo (.+)/, group: :blegh, method: :foo2
|
|
223
|
-
match /foo .+/, method: :foo3
|
|
224
|
-
def foo1(m, arg)
|
|
225
|
-
m.reply "foo1"
|
|
226
|
-
end
|
|
223
|
+
```ruby
|
|
224
|
+
class Foo
|
|
225
|
+
include Cinch::Plugin
|
|
227
226
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
match /foo (\d+)/, group: :blegh, method: :foo1
|
|
228
|
+
match /foo (.+)/, group: :blegh, method: :foo2
|
|
229
|
+
match /foo .+/, method: :foo3
|
|
230
|
+
def foo1(m, arg)
|
|
231
|
+
m.reply "foo1"
|
|
232
|
+
end
|
|
231
233
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
end
|
|
236
|
-
# 02:05:39 dominikh │ !foo 123
|
|
237
|
-
# 02:05:40 cinch │ foo1
|
|
238
|
-
# 02:05:40 cinch │ foo3
|
|
234
|
+
def foo2(m, arg)
|
|
235
|
+
m.reply "foo2"
|
|
236
|
+
end
|
|
239
237
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
238
|
+
def foo3(m)
|
|
239
|
+
m.reply "foo3"
|
|
240
|
+
end
|
|
241
|
+
end
|
|
242
|
+
# 02:05:39 dominikh │ !foo 123
|
|
243
|
+
# 02:05:40 cinch │ foo1
|
|
244
|
+
# 02:05:40 cinch │ foo3
|
|
243
245
|
|
|
246
|
+
# 02:05:43 dominikh │ !foo bar
|
|
247
|
+
# 02:05:44 cinch │ foo2
|
|
248
|
+
# 02:05:44 cinch │ foo3
|
|
249
|
+
```
|
|
244
250
|
|
|
245
|
-
|
|
251
|
+
### Added match options overwriting plugin options
|
|
246
252
|
|
|
247
253
|
Matchers now have their own `:prefix`, `:suffix` and `:react_on`
|
|
248
254
|
options which overwrite plugin options for single matchers.
|
|
249
255
|
|
|
250
|
-
|
|
251
|
-
## Added support for actions (/me)
|
|
256
|
+
### Added support for actions (/me)
|
|
252
257
|
|
|
253
258
|
A new event, {`:action`} has been added and can be used for matching
|
|
254
259
|
actions as follows:
|
|
255
260
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
261
|
+
```ruby
|
|
262
|
+
match "kicks the bot", react_on: :action
|
|
263
|
+
def execute(m)
|
|
264
|
+
m.reply "Ouch!"
|
|
265
|
+
end
|
|
266
|
+
```
|
|
260
267
|
|
|
261
|
-
|
|
268
|
+
### API improvements
|
|
262
269
|
|
|
263
|
-
|
|
270
|
+
#### Helper changes
|
|
264
271
|
|
|
265
|
-
The helper methods
|
|
266
|
-
|
|
267
|
-
|
|
272
|
+
The helper methods [`User()`](../lib/cinch/helpers.rb) and
|
|
273
|
+
[`Channel()`](../lib/cinch/helpers.rb) have been extracted from
|
|
274
|
+
[`Cinch::Bot`](../lib/cinch/bot.rb) and moved to [their own module](../lib/cinch/helpers.rb) which can
|
|
268
275
|
be reused in various places.
|
|
269
276
|
|
|
270
|
-
|
|
277
|
+
#### Added a [Target](../lib/cinch/target.rb) class
|
|
271
278
|
|
|
272
|
-
Since
|
|
279
|
+
Since [`Cinch::Channel`](../lib/cinch/channel.rb) and [`Cinch::User`](../lib/cinch/user.rb) share one common interface
|
|
273
280
|
for sending messages, it only makes sense to have a common base class.
|
|
274
|
-
|
|
275
|
-
removes this responsibility from
|
|
276
|
-
|
|
281
|
+
[This new class](../lib/cinch/target.rb) takes care of sending messages and
|
|
282
|
+
removes this responsibility from [`Cinch::Channel`](../lib/cinch/channel.rb), [`Cinch::User`](../lib/cinch/user.rb) and
|
|
283
|
+
[`Cinch::Bot`](../lib/cinch/bot.rb)
|
|
277
284
|
|
|
278
|
-
|
|
285
|
+
#### [`Cinch::Constants`](../lib/cinch/constants.rb)
|
|
279
286
|
|
|
280
287
|
All constants for IRC numeric replies (`RPL_*` and `ERR_*`) have been
|
|
281
|
-
moved from
|
|
288
|
+
moved from [`Cinch`](../lib/cinch/ban.rb) to [`Cinch::Constants`](../lib/cinch/constants.rb)
|
|
282
289
|
|
|
283
|
-
|
|
290
|
+
#### New methods
|
|
284
291
|
|
|
285
|
-
|
|
292
|
+
##### [`Cinch::Bot`](../lib/cinch/bot.rb)
|
|
286
293
|
|
|
287
|
-
-
|
|
288
|
-
-
|
|
289
|
-
-
|
|
290
|
-
-
|
|
291
|
-
-
|
|
292
|
-
-
|
|
293
|
-
-
|
|
294
|
-
-
|
|
295
|
-
-
|
|
294
|
+
- [`Cinch::Bot#channel_list`](../lib/cinch/bot.rb)
|
|
295
|
+
- [`Cinch::Bot#handlers`](../lib/cinch/bot.rb)
|
|
296
|
+
- [`Cinch::Bot#loggers`](../lib/cinch/bot.rb)
|
|
297
|
+
- [`Cinch::Bot#loggers=`](../lib/cinch/bot.rb)
|
|
298
|
+
- [`Cinch::Bot#modes`](../lib/cinch/bot.rb)
|
|
299
|
+
- [`Cinch::Bot#modes=`](../lib/cinch/bot.rb)
|
|
300
|
+
- [`Cinch::Bot#set_mode`](../lib/cinch/bot.rb)
|
|
301
|
+
- [`Cinch::Bot#unset_mode`](../lib/cinch/bot.rb)
|
|
302
|
+
- [`Cinch::Bot#user_list`](../lib/cinch/bot.rb)
|
|
296
303
|
|
|
297
|
-
|
|
304
|
+
##### [`Cinch::Channel`](../lib/cinch/channel.rb)
|
|
298
305
|
|
|
299
|
-
-
|
|
300
|
-
-
|
|
301
|
-
-
|
|
302
|
-
-
|
|
303
|
-
-
|
|
306
|
+
- [`Cinch::Channel#admins`](../lib/cinch/channel.rb)
|
|
307
|
+
- [`Cinch::Channel#half_ops`](../lib/cinch/channel.rb)
|
|
308
|
+
- [`Cinch::Channel#ops`](../lib/cinch/channel.rb)
|
|
309
|
+
- [`Cinch::Channel#owners`](../lib/cinch/channel.rb)
|
|
310
|
+
- [`Cinch::Channel#voiced`](../lib/cinch/channel.rb)
|
|
304
311
|
|
|
305
|
-
|
|
312
|
+
##### [`Cinch::Helpers`](../lib/cinch/helpers.rb)
|
|
306
313
|
|
|
307
|
-
-
|
|
308
|
-
-
|
|
309
|
-
-
|
|
310
|
-
-
|
|
314
|
+
- [`Cinch::Helpers#Target`](../lib/cinch/helpers.rb) -- For creating a [Target](../lib/cinch/target.rb) which can receive messages
|
|
315
|
+
- [`Cinch::Helpers#Timer`](../lib/cinch/helpers.rb) -- For creating new timers anywhere
|
|
316
|
+
- [`Cinch::Helpers#rescue_exception`](../lib/cinch/helpers.rb) -- For rescueing and automatically logging an exception
|
|
317
|
+
- [`Cinch::Helpers#Format`](../lib/cinch/helpers.rb) -- For adding colors and formatting to messages
|
|
311
318
|
|
|
312
|
-
|
|
313
|
-
- {Cinch::Helpers#debug}
|
|
314
|
-
- {Cinch::Helpers#error}
|
|
315
|
-
- {Cinch::Helpers#exception}
|
|
316
|
-
- {Cinch::Helpers#fatal}
|
|
317
|
-
- {Cinch::Helpers#incoming}
|
|
318
|
-
- {Cinch::Helpers#info}
|
|
319
|
-
- {Cinch::Helpers#log}
|
|
320
|
-
- {Cinch::Helpers#outgoing}
|
|
321
|
-
- {Cinch::Helpers#warn}
|
|
319
|
+
###### Logging shortcuts
|
|
322
320
|
|
|
323
|
-
|
|
321
|
+
- [`Cinch::Helpers#debug`](../lib/cinch/helpers.rb)
|
|
322
|
+
- [`Cinch::Helpers#error`](../lib/cinch/helpers.rb)
|
|
323
|
+
- [`Cinch::Helpers#exception`](../lib/cinch/helpers.rb)
|
|
324
|
+
- [`Cinch::Helpers#fatal`](../lib/cinch/helpers.rb)
|
|
325
|
+
- [`Cinch::Helpers#incoming`](../lib/cinch/helpers.rb)
|
|
326
|
+
- [`Cinch::Helpers#info`](../lib/cinch/helpers.rb)
|
|
327
|
+
- [`Cinch::Helpers#log`](../lib/cinch/helpers.rb)
|
|
328
|
+
- [`Cinch::Helpers#outgoing`](../lib/cinch/helpers.rb)
|
|
329
|
+
- [`Cinch::Helpers#warn`](../lib/cinch/helpers.rb)
|
|
324
330
|
|
|
325
|
-
|
|
331
|
+
##### [`Cinch::IRC`](../lib/cinch/irc.rb)
|
|
326
332
|
|
|
327
|
-
|
|
333
|
+
- [`Cinch::IRC#network`](../lib/cinch/irc.rb)
|
|
328
334
|
|
|
329
|
-
|
|
330
|
-
- {Cinch::Message#action_message}
|
|
331
|
-
- {Cinch::Message#target}
|
|
332
|
-
- {Cinch::Message#time}
|
|
335
|
+
##### [`Cinch::Message`](../lib/cinch/message.rb)
|
|
333
336
|
|
|
334
|
-
|
|
337
|
+
- [`Cinch::Message#action?`](../lib/cinch/message.rb)
|
|
338
|
+
- [`Cinch::Message#action_message`](../lib/cinch/message.rb)
|
|
339
|
+
- [`Cinch::Message#target`](../lib/cinch/message.rb)
|
|
340
|
+
- [`Cinch::Message#time`](../lib/cinch/message.rb)
|
|
335
341
|
|
|
336
|
-
|
|
337
|
-
- {Cinch::Plugin#timers}
|
|
338
|
-
- {Cinch::Plugin#unregister}
|
|
342
|
+
##### [`Cinch::Plugin`](../lib/cinch/plugin.rb)
|
|
339
343
|
|
|
340
|
-
|
|
344
|
+
- [`Cinch::Plugin#handlers`](../lib/cinch/plugin.rb)
|
|
345
|
+
- [`Cinch::Plugin#timers`](../lib/cinch/plugin.rb)
|
|
346
|
+
- [`Cinch::Plugin#unregister`](../lib/cinch/plugin.rb)
|
|
341
347
|
|
|
342
|
-
|
|
343
|
-
- {Cinch::User#dcc_send} - See {Cinch::DCC::Outgoing::Send}
|
|
344
|
-
- {Cinch::User#match}
|
|
345
|
-
- {Cinch::User#monitor} - See {file:docs/common_tasks.md#checking-if-a-user-is-online Checking if a user is online}
|
|
346
|
-
- {Cinch::User#monitored}
|
|
347
|
-
- {Cinch::User#online?}
|
|
348
|
-
- {Cinch::User#unmonitor}
|
|
348
|
+
##### [`Cinch::User`](../lib/cinch/user.rb)
|
|
349
349
|
|
|
350
|
-
|
|
350
|
+
- [`Cinch::User#away`](../lib/cinch/user.rb)
|
|
351
|
+
- [`Cinch::User#dcc_send`](../lib/cinch/user.rb) - See [`Cinch::DCC::Outgoing::Send`](../lib/cinch/dcc/outgoing/send.rb)
|
|
352
|
+
- [`Cinch::User#match`](../lib/cinch/user.rb)
|
|
353
|
+
- [`Cinch::User#monitor`](../lib/cinch/user.rb) - See [Checking if a user is online](common_tasks.md#checking-if-a-user-is-online)
|
|
354
|
+
- [`Cinch::User#monitored`](../lib/cinch/user.rb)
|
|
355
|
+
- [`Cinch::User#online?`](../lib/cinch/user.rb)
|
|
356
|
+
- [`Cinch::User#unmonitor`](../lib/cinch/user.rb)
|
|
351
357
|
|
|
352
|
-
|
|
358
|
+
#### Handlers
|
|
359
|
+
|
|
360
|
+
Internally, Cinch uses [Handlers](../lib/cinch/handler.rb) for listening to and
|
|
353
361
|
matching events. In previous versions, this was hidden from the user,
|
|
354
362
|
but now they're part of the public API, providing valuable information
|
|
355
|
-
and the chance to
|
|
363
|
+
and the chance to [unregister handlers](../lib/cinch/handler.rb)
|
|
356
364
|
alltogether.
|
|
357
365
|
|
|
358
|
-
|
|
359
|
-
|
|
366
|
+
[`Cinch::Bot#on`](../lib/cinch/bot.rb) now returns the created handler and
|
|
367
|
+
[`Cinch::Plugin#handlers`](../lib/cinch/plugin.rb) allows getting a plugin's registered
|
|
360
368
|
handlers.
|
|
361
369
|
|
|
362
|
-
|
|
370
|
+
#### Removed/Renamed methods
|
|
371
|
+
|
|
363
372
|
The following methods have been removed:
|
|
364
373
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
### The Plugin class
|
|
387
|
-
|
|
388
|
-
The {Cinch::Plugin Plugin} class has been drastically improved to look
|
|
374
|
+
- `Cinch::Bot#halt` → `next` or `break` (Ruby keywords)
|
|
375
|
+
- `Cinch::Bot#raw` → [`Cinch::IRC#send`](../lib/cinch/irc.rb)
|
|
376
|
+
- `Cinch::Bot#msg` → [`Cinch::Target#msg`](../lib/cinch/target.rb)
|
|
377
|
+
- `Cinch::Bot#notice` → [`Cinch::Target#notice`](../lib/cinch/target.rb)
|
|
378
|
+
- `Cinch::Bot#safe_msg` → [`Cinch::Target#safe_msg`](../lib/cinch/target.rb)
|
|
379
|
+
- `Cinch::Bot#safe_notice` → [`Cinch::Target#safe_notice`](../lib/cinch/target.rb)
|
|
380
|
+
- `Cinch::Bot#action` → [`Cinch::Target#action`](../lib/cinch/target.rb)
|
|
381
|
+
- `Cinch::Bot#safe_action` → [`Cinch::Target#safe_action`](../lib/cinch/target.rb)
|
|
382
|
+
- `Cinch::Bot#dispatch` → [`Cinch::HandlerList#dispatch`](../lib/cinch/handler_list.rb)
|
|
383
|
+
- `Cinch::Bot#register_plugins` → [`Cinch::PluginList#register_plugins`](../lib/cinch/plugin_list.rb)
|
|
384
|
+
- `Cinch::Bot#register_plugin` → [`Cinch::PluginList#register_plugin`](../lib/cinch/plugin_list.rb)
|
|
385
|
+
- `Cinch::Bot#logger` → [`Cinch::Bot#loggers`](../lib/cinch/bot.rb)
|
|
386
|
+
- `Cinch::Bot#logger=` was removed.
|
|
387
|
+
- `Cinch::Bot#debug` → [`Cinch::LoggerList#debug`](../lib/cinch/logger_list.rb)
|
|
388
|
+
- `Cinch::IRC#message` → [`Cinch::IRC#send`](../lib/cinch/irc.rb)
|
|
389
|
+
- `Cinch::Logger::Logger#log_exception` → [`Cinch::Logger#exception`](../lib/cinch/logger.rb)
|
|
390
|
+
- Class methods in Plugin to set options → A new [`set`](../lib/cinch/plugin.rb) method as well as attribute setters
|
|
391
|
+
|
|
392
|
+
#### The Plugin class
|
|
393
|
+
|
|
394
|
+
The [Plugin](../lib/cinch/plugin.rb) class has been drastically improved to look
|
|
389
395
|
and behave more like a proper Ruby class instead of being some
|
|
390
396
|
abstract black box.
|
|
391
397
|
|
|
@@ -395,147 +401,152 @@ possible to access a Plugin instance's registered handlers and timers,
|
|
|
395
401
|
as well as unregister plugins.
|
|
396
402
|
|
|
397
403
|
For a complete overview of available attributes and methods, see
|
|
398
|
-
|
|
404
|
+
[`Cinch::Plugin`](../lib/cinch/plugin.rb) and [`Cinch::Plugin::ClassMethods`](../lib/cinch/plugin.rb).
|
|
399
405
|
|
|
400
|
-
|
|
406
|
+
#### Plugin options
|
|
401
407
|
|
|
402
408
|
The aforementioned changes also affect the way plugin options are
|
|
403
409
|
being set: Plugin options aren't set with DSL-like methods anymore but
|
|
404
|
-
instead are made available via
|
|
405
|
-
`set` method} or alternatively plain attribute setters.
|
|
410
|
+
instead are made available via [a `set` method](../lib/cinch/plugin.rb) or alternatively plain attribute setters.
|
|
406
411
|
|
|
407
412
|
See
|
|
408
|
-
|
|
413
|
+
[the migration guide](migrating.md#plugin-options) for more
|
|
409
414
|
information.
|
|
410
415
|
|
|
411
|
-
|
|
416
|
+
#### Channel/Target/User implement Comparable
|
|
412
417
|
|
|
413
|
-
|
|
418
|
+
[`Cinch::Target`](../lib/cinch/target.rb) and thus [`Cinch::Channel`](../lib/cinch/channel.rb) and [`Cinch::User`](../lib/cinch/user.rb) now
|
|
414
419
|
implement the Comparable interface, which makes them sortable by all
|
|
415
420
|
usual Ruby means.
|
|
416
421
|
|
|
417
|
-
|
|
422
|
+
#### Renamed `*Manager` to `*List`
|
|
418
423
|
|
|
419
424
|
`Cinch::ChannelManager` and `Cinch::UserManager` have been renamed to
|
|
420
|
-
|
|
425
|
+
[`Cinch::ChannelList`](../lib/cinch/channel_list.rb) and [`Cinch::UserList`](../lib/cinch/user_list.rb) respectively.
|
|
426
|
+
|
|
427
|
+
### Added support for broken IRC networks
|
|
421
428
|
|
|
422
|
-
## Added support for broken IRC networks
|
|
423
429
|
Special support for the following flawed IRC networks has been added:
|
|
424
430
|
|
|
425
431
|
- JustinTV
|
|
426
432
|
- NGameTV
|
|
427
433
|
- IRCnet
|
|
428
434
|
|
|
429
|
-
|
|
435
|
+
### Dynamic timers
|
|
430
436
|
|
|
431
437
|
It is now possible to create new timers from any method/handler. It is
|
|
432
|
-
also possible to
|
|
433
|
-
|
|
438
|
+
also possible to [stop existing timers](../lib/cinch/timer.rb) or
|
|
439
|
+
[restart them](../lib/cinch/timer.rb).
|
|
434
440
|
|
|
435
441
|
The easiest way of creating new timers is by using the
|
|
436
|
-
|
|
437
|
-
possible, albeit more complex, to create instances of
|
|
442
|
+
[Timer helper method](../lib/cinch/helpers.rb), even though it is also
|
|
443
|
+
possible, albeit more complex, to create instances of [`Cinch::Timer`](../lib/cinch/timer.rb)
|
|
438
444
|
directly.
|
|
439
445
|
|
|
440
446
|
Example:
|
|
441
447
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
- :
|
|
456
|
-
- :
|
|
457
|
-
- :
|
|
458
|
-
- :
|
|
459
|
-
- :
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
-
|
|
466
|
-
-
|
|
467
|
-
-
|
|
468
|
-
-
|
|
469
|
-
-
|
|
470
|
-
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
448
|
+
```ruby
|
|
449
|
+
match /remind me in (\d+) seconds/
|
|
450
|
+
def execute(m, seconds)
|
|
451
|
+
Timer(seconds.to_i, shots: 1) do
|
|
452
|
+
m.reply "This is your reminder.", true
|
|
453
|
+
end
|
|
454
|
+
end
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
For more information on timers, see the [Timer documentation](../lib/cinch/timer.rb).
|
|
458
|
+
|
|
459
|
+
### New options
|
|
460
|
+
|
|
461
|
+
- [:dcc.own_ip](bot_options.md#dccown_ip)
|
|
462
|
+
- [:modes](bot_options.md#modes)
|
|
463
|
+
- [:max_reconnect_delay](bot_options.md#max_reconnect_delay)
|
|
464
|
+
- [:local_host](bot_options.md#local_host)
|
|
465
|
+
- [:delay_joins](bot_options.md#delay_joins)
|
|
466
|
+
- [:sasl.username](bot_options.md#saslusername)
|
|
467
|
+
- [:sasl.password](bot_options.md#saslpassword)
|
|
468
|
+
|
|
469
|
+
### New events
|
|
470
|
+
|
|
471
|
+
- [`:action`](events.md#action)
|
|
472
|
+
- [`:away`](events.md#away)
|
|
473
|
+
- [`:unaway`](events.md#unaway)
|
|
474
|
+
- [`:dcc_send`](events.md#dcc_send)
|
|
475
|
+
- [`:owner`](events.md#owner)
|
|
476
|
+
- [`:deowner`](events.md#dehalfop-deop-deowner-devoice)
|
|
477
|
+
- [`:leaving`](events.md#leaving)
|
|
478
|
+
- [`:online`](events.md#online)
|
|
479
|
+
- [`:offline`](events.md#offline)
|
|
480
|
+
|
|
481
|
+
## What has changed in 1.1?
|
|
482
|
+
|
|
474
483
|
1. **New events**
|
|
475
484
|
2. **New methods**
|
|
476
485
|
3. **New options**
|
|
477
486
|
4. **Improved logger**
|
|
478
|
-
|
|
487
|
+
5. **Deprecated methods**
|
|
479
488
|
|
|
480
|
-
|
|
489
|
+
### New events
|
|
481
490
|
|
|
482
|
-
-
|
|
483
|
-
-
|
|
484
|
-
-
|
|
485
|
-
-
|
|
486
|
-
-
|
|
487
|
-
-
|
|
488
|
-
-
|
|
489
|
-
-
|
|
490
|
-
-
|
|
491
|
-
-
|
|
491
|
+
- [`:op`](events.md#op)
|
|
492
|
+
- [`:deop`](events.md#dehalfop-deop-deowner-devoice)
|
|
493
|
+
- [`:voice`](events.md#voice)
|
|
494
|
+
- [`:devoice`](events.md#dehalfop-deop-deowner-devoice)
|
|
495
|
+
- [`:halfop`](events.md#halfop)
|
|
496
|
+
- [`:dehalfop`](events.md#dehalfop-deop-deowner-devoice)
|
|
497
|
+
- [`:ban`](events.md#ban)
|
|
498
|
+
- [`:unban`](events.md#unban)
|
|
499
|
+
- [`:mode_change`](events.md#mode_change)
|
|
500
|
+
- [`:catchall`](events.md#catchall)
|
|
492
501
|
|
|
493
502
|
Additionally, plugins are now able to send their own events by using
|
|
494
503
|
Cinch::Bot#dispatch.
|
|
495
504
|
|
|
496
|
-
|
|
505
|
+
### New methods
|
|
506
|
+
|
|
507
|
+
#### [`Cinch::User#last_nick`](../lib/cinch/user.rb)
|
|
497
508
|
|
|
498
|
-
### {Cinch::User#last_nick}
|
|
499
509
|
Stores the last nick of a user. This can for example be used in `on
|
|
500
510
|
:nick` to compare a user's old nick against the new one.
|
|
501
511
|
|
|
502
|
-
|
|
512
|
+
#### Cinch::User#notice, Cinch::Channel#notice and Cinch::Bot#notice
|
|
513
|
+
|
|
503
514
|
For sending notices.
|
|
504
515
|
|
|
505
|
-
|
|
506
|
-
|
|
516
|
+
#### [`Cinch::Message#to_s`](../lib/cinch/message.rb)
|
|
517
|
+
|
|
518
|
+
Provides a nicer representation of [`Cinch::Message`](../lib/cinch/message.rb) objects.
|
|
519
|
+
|
|
520
|
+
#### [`Cinch::Channel#has_user?`](../lib/cinch/channel.rb)
|
|
507
521
|
|
|
508
|
-
### {Cinch::Channel#has_user?}
|
|
509
522
|
Provides an easier way of checking if a given user is in a channel
|
|
510
523
|
|
|
511
|
-
|
|
512
|
-
- {file:docs/bot_options.md#pluginssuffix plugins.suffix}
|
|
513
|
-
- {file:docs/bot_options.md#ssluse ssl.use}
|
|
514
|
-
- {file:docs/bot_options.md#sslverify ssl.verify}
|
|
515
|
-
- {file:docs/bot_options.md#sslcapath ssl.ca_path}
|
|
516
|
-
- {file:docs/bot_options.md#sslclientcert ssl.client_cert}
|
|
517
|
-
- {file:docs/bot_options.md#nicks nicks}
|
|
518
|
-
- {file:docs/bot_options.md#timeoutsread timeouts.read}
|
|
519
|
-
- {file:docs/bot_options.md#timeoutsconnect timeouts.connect}
|
|
520
|
-
- {file:docs/bot_options.md#pinginterval ping_interval}
|
|
521
|
-
- {file:docs/bot_options.md#reconnect reconnect}
|
|
524
|
+
### New options
|
|
522
525
|
|
|
526
|
+
- [`plugins.suffix`](bot_options.md#pluginssuffix)
|
|
527
|
+
- [`ssl.use`](bot_options.md#ssluse)
|
|
528
|
+
- [`ssl.verify`](bot_options.md#sslverify)
|
|
529
|
+
- [`ssl.ca_path`](bot_options.md#sslca_path)
|
|
530
|
+
- [`ssl.client_cert`](bot_options.md#sslclient_cert)
|
|
531
|
+
- [`nicks`](bot_options.md#nicks)
|
|
532
|
+
- [`timeouts.read`](bot_options.md#timeoutsread)
|
|
533
|
+
- [`timeouts.connect`](bot_options.md#timeoutsconnect)
|
|
534
|
+
- [`ping_interval`](bot_options.md#ping_interval)
|
|
535
|
+
- [`reconnect`](bot_options.md#reconnect)
|
|
523
536
|
|
|
537
|
+
### Improved logger
|
|
524
538
|
|
|
525
|
-
|
|
526
|
-
The {Cinch::Logger::FormattedLogger formatted logger} (which is the
|
|
539
|
+
The [formatted logger](../lib/cinch/logger/formatted_logger.rb) (which is the
|
|
527
540
|
default one) now contains timestamps. Furthermore, it won't emit color
|
|
528
541
|
codes if not writing to a TTY.
|
|
529
542
|
|
|
530
543
|
Additionally, it can now log any kind of object, not only strings.
|
|
531
544
|
|
|
532
|
-
|
|
545
|
+
### Deprecated methods
|
|
533
546
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
| Cinch::Channel.find | Cinch::ChannelManager#find |
|
|
541
|
-
| Cinch::Channel.all | Cinch::ChannelManager#each |
|
|
547
|
+
- `Cinch::User.find_ensured` → `Cinch::UserManager#find_ensured`
|
|
548
|
+
- `Cinch::User.find` → `Cinch::UserManager#find`
|
|
549
|
+
- `Cinch::User.all` → `Cinch::UserManager#each`
|
|
550
|
+
- `Cinch::Channel.find_ensured` → `Cinch::ChannelManager#find_ensured`
|
|
551
|
+
- `Cinch::Channel.find` → `Cinch::ChannelManager#find`
|
|
552
|
+
- `Cinch::Channel.all` → `Cinch::ChannelManager#each`
|