99a2ae25 |
1 | \input texinfo @c -*- texinfo -*- |
2e20c3e1 |
2 | @c %**start of header |
3 | @setfilename bobot++.info |
4 | @settitle Bobot++: A Schemeable IRC Bot |
5 | @setchapternewpage on |
6 | @c %**end of header |
7 | |
8 | @ifinfo |
9 | This file documents Bobot++ by Clinton Ebadi and Etienne Bernard |
e45daca1 |
10 | (The original author who no longer works on the program). |
2e20c3e1 |
11 | |
2e18045a |
12 | Copyright 2002,2004,2005 Clinton Ebadi |
2e20c3e1 |
13 | |
14 | Permission is granted to copy, distribute and/or modify this document |
15 | under the terms of the GNU Free Documentation License, Version 1.1 or |
16 | any later version published by the Free Software Foundation; with no |
17 | Invariant Sections, with no Front-Cover Texts, and with no Back-Cover |
18 | Texts. |
19 | |
20 | @end ifinfo |
21 | |
22 | @titlepage |
23 | @title Bobot++: A Schemeable IRC Bot |
24 | @author Clinton Ebadi |
25 | |
26 | @page |
ac18ad3d |
27 | @vskip 0pt plus 1filll |
2e18045a |
28 | Copyright @copyright{} 2002,2004,2005 Clinton Ebadi |
2e20c3e1 |
29 | |
30 | Permission is granted to copy, distribute and/or modify this document |
31 | under the terms of the GNU Free Documentation License, Version 1.1 or |
32 | any later version published by the Free Software Foundation; with no |
33 | Invariant Sections, with no Front-Cover Texts, and with no Back-Cover |
34 | Texts. |
35 | |
36 | @end titlepage |
37 | |
38 | @node Top, Introduction, (dir), (dir) |
39 | @comment node-name, next, previous, up |
40 | |
41 | @ifinfo |
42 | This document describes Bobot++ by Clinton Ebadi and Etienne Bernard |
e45daca1 |
43 | (The original author who no longer works on the program). |
2e20c3e1 |
44 | |
7b564711 |
45 | This document applies to version 2.2 of the program named |
e45daca1 |
46 | Bobot++. |
439869bf |
47 | |
7b564711 |
48 | Copyright 2002,2004,2005 Clinton Ebadi |
439869bf |
49 | |
50 | Permission is granted to copy, distribute and/or modify this document |
51 | under the terms of the GNU Free Documentation License, Version 1.1 or |
52 | any later version published by the Free Software Foundation; with no |
53 | Invariant Sections, with no Front-Cover Texts, and with no Back-Cover |
54 | Texts. |
2e20c3e1 |
55 | @end ifinfo |
56 | |
57 | @menu |
58 | * Introduction:: |
31433d27 |
59 | * Configuration:: |
e07b6b46 |
60 | * Using the Bot:: |
31433d27 |
61 | * Scripting:: |
62 | * Concept Index:: |
63 | * Function Index:: |
64 | * Variable Index:: |
c7d9fb19 |
65 | |
66 | @detailmenu |
67 | --- The Detailed Node Listing --- |
68 | |
69 | Configuration |
70 | |
c7d9fb19 |
71 | * Configuration File Placement:: |
ac18ad3d |
72 | * Configuration Files:: |
c7d9fb19 |
73 | |
74 | Configuration Files |
75 | |
76 | * bot.conf:: |
c8f13c06 |
77 | * bot.users:: |
528799bd |
78 | * bot.shit:: |
c7d9fb19 |
79 | |
80 | bot.conf |
81 | |
82 | * server syntax:: |
83 | * channel syntax:: |
84 | |
85 | Using Bobot++ |
86 | |
6b59e728 |
87 | * Starting the Bot:: |
c7d9fb19 |
88 | * User Levels:: |
c8f13c06 |
89 | * Protection:: |
90 | * Automatic Op:: |
528799bd |
91 | * Shit Levels:: |
6b59e728 |
92 | * Built-In Commands:: |
c7d9fb19 |
93 | |
94 | Scripting |
95 | |
96 | * Adding New Commands:: |
97 | * Hooks:: |
c7d9fb19 |
98 | * Sending Messages:: |
99 | * Misc Scripting Stuff:: |
100 | |
101 | Hooks |
102 | |
103 | * Creating a Hook:: |
104 | * Hook Types:: |
105 | |
ae97d6ec |
106 | Hook Types |
107 | |
108 | * Received Message Hooks:: |
109 | * Sent Message Hooks:: |
110 | * DCC CHAT Hooks:: |
111 | * Miscellaneous Hooks:: |
112 | |
c7d9fb19 |
113 | Sending Messages |
114 | |
115 | * High Level Message Functions:: |
116 | * Low Level Message Functions:: |
117 | |
118 | @end detailmenu |
2e20c3e1 |
119 | @end menu |
120 | |
31433d27 |
121 | @node Introduction, Configuration, Top, Top |
2e20c3e1 |
122 | @chapter Introduction |
123 | |
528799bd |
124 | Bobot++ is a powerful IRC bot written in C++. It can be used |
125 | standalone as a channel maintenence bot, or extended to do almost |
126 | anything using Scheme scripts. |
127 | |
128 | FIXME: Fill the intro in more? |
31433d27 |
129 | |
e07b6b46 |
130 | @node Configuration, Using the Bot, Introduction, Top |
31433d27 |
131 | @chapter Configuration |
132 | |
c8f13c06 |
133 | Bobot++ is easy to configure. See the @file{examples} directory for an |
e45daca1 |
134 | example configuration. |
135 | |
136 | The main configuration file is @file{bot.conf}. There are several |
137 | auxiliary configuration files (a user list, aliases file, ban list, |
138 | and a script autoexec). |
31433d27 |
139 | |
140 | @menu |
c7d9fb19 |
141 | * Configuration File Placement:: |
ac18ad3d |
142 | * Configuration Files:: |
31433d27 |
143 | @end menu |
144 | |
ac18ad3d |
145 | @node Configuration File Placement, Configuration Files, Configuration, Configuration |
146 | @section Configuration File Placement |
147 | |
148 | Bobot++ will look in @file{/etc/bobotpp/default/} for its default |
149 | config if none is specified on the command line. Put the configuration |
150 | files you want to be loaded by default in this directory. If you are |
e45daca1 |
151 | not root, or you want to have your own personal configuration, put it |
ac18ad3d |
152 | in @file{~/.bobotpp/config/default/}. |
153 | |
154 | @node Configuration Files, , Configuration File Placement, Configuration |
c7d9fb19 |
155 | @section Configuration Files |
31433d27 |
156 | |
e171dcce |
157 | @menu |
158 | * bot.conf:: |
c8f13c06 |
159 | * bot.users:: |
528799bd |
160 | * bot.shit:: |
e171dcce |
161 | @end menu |
162 | |
c8f13c06 |
163 | @node bot.conf, bot.users, Configuration Files, Configuration Files |
e171dcce |
164 | @subsection bot.conf |
165 | |
c7d9fb19 |
166 | @file{bot.conf} contains key value pairs separated by @code{=}. |
167 | |
168 | @code{<key> = <value>} |
169 | |
170 | Comments are started with a @code{#} and cause the entire line to be |
171 | ignored. @emph{Note that this only works when the @code{#} is the first |
172 | character of the line}. |
173 | |
e171dcce |
174 | bot.conf is the main configuration file for a Bobot++. The available |
175 | configuration variables are listed below in the format ``@var{variable} |
176 | <default-value>: description'' |
177 | |
e45daca1 |
178 | A few of the options have more complex syntax, they are documented in |
179 | their own subsections. |
180 | |
181 | @menu |
182 | * server syntax:: |
183 | * channel syntax:: |
184 | @end menu |
185 | |
e171dcce |
186 | @itemize @bullet |
187 | |
528799bd |
188 | @item @var{maxnicklength} <9>: The maximum length a valid nickname may |
189 | be. This should be set before setting the bot's nickname if it will be |
190 | more than nine characters long. Most IRC servers support nicknames |
191 | longer than nine characters, but Bobot++ still follows the old spec |
192 | and defaults to nine. |
e171dcce |
193 | @item @var{nickname} <Bobot>: The nickname of the bot (@var{nick} is an |
194 | alias for @var{nickname}) |
195 | @item @var{username} <bobot>: The IRC username of the bot |
196 | @item @var{cmdchar} <!>: The character that prefixes commands given to |
197 | the bot (@var{command} is an alias for @var{cmdchar}) |
198 | @item @var{ircname} <I'm a bobot++!>: The IRC name (or 'real name') of |
199 | the bot (@var{realname} is an alias for @var{ircname}) |
200 | @item @var{userlist} <bot.users>: Name of the file where the userlist is |
201 | stored |
e45daca1 |
202 | @item @var{shitlist} <bot.shit>: Name of the file where the shitlist |
203 | (ban list) is stored |
c7d9fb19 |
204 | @item @var{logfile} <$LOGDIR/bot.log>: Location of the bot logfile |
205 | (set this to @file{/dev/null} to disable logging). |
e45daca1 |
206 | @item @var{server} <None>: This specifies the server to which the bot |
207 | will connect. Note that this has a special syntax @pxref{server |
208 | syntax}. |
209 | @item @var{channel} <None>: This specifies the channels the bot will join |
210 | when it starts up. This has a special syntax @pxref{channel |
211 | syntax}. |
e171dcce |
212 | |
213 | @end itemize |
31433d27 |
214 | |
c7d9fb19 |
215 | @node server syntax, channel syntax, bot.conf, bot.conf |
216 | @subsubsection server syntax |
217 | |
e45daca1 |
218 | The server syntax in @file{bot.conf} allows you to specify an |
219 | alternate port to connect on, and a password to send the server. |
220 | |
221 | You may use more than one server line; Bobot++ will attempt to connect |
222 | to the first one, and will connect to the next one in the list if it |
223 | fails. The bot will continue cycling through the server list until it |
224 | is able to connect to one. There is a command (@code{!cycle}) to make |
225 | the bot to cycle servers. |
226 | |
c7d9fb19 |
227 | @var{server} = @var{server_name} [@var{port} [@var{password}]] |
228 | |
229 | This will make Bobot++ attempt to connect to @var{server_name} on port |
230 | @var{port} with the password @var{password}. @var{server_name} should |
231 | be the address of the server. @var{port} and @var{password} are |
e45daca1 |
232 | optional. |
c7d9fb19 |
233 | |
234 | @node channel syntax, , server syntax, bot.conf |
235 | @subsubsection channel syntax |
236 | |
e45daca1 |
237 | The channel syntax in @file{bot.conf} allows you to specify the |
238 | initial modes the bot should set on a channel, the modes the bot |
239 | should maintain, and a key if the channel needs it. |
240 | |
241 | You may have any number of channel lines. When Bobot++ starts it will |
242 | attempt to join and gain operator status in every channel listed. |
243 | |
c7d9fb19 |
244 | @var{channel} = |
245 | @var{name}:@var{initial_modes}:@var{modes_to_keep}:@var{channel_key} |
246 | |
e45daca1 |
247 | The bot will join @var{name} and set the channel modes to |
248 | @var{initial_modes} (e.g. ``nt'') if it is able to gain operator |
249 | status. It will then maintain @var{modes_to_keep}. If the channel |
250 | requires a key to enter simply set @var{channel_key}. Every argument |
251 | except for @var{name} is optional. |
c7d9fb19 |
252 | |
253 | A few example lines: |
254 | |
e45daca1 |
255 | @example |
256 | @var{channel} = #foo:nt:nt:bar |
257 | @end example |
c7d9fb19 |
258 | |
259 | The bot will join @code{#foo} with the channel key @code{bar} and will |
260 | then maintain the modes @code{nt}. |
261 | |
e45daca1 |
262 | @example |
263 | @var{channel} = #bar::: |
264 | @end example |
c7d9fb19 |
265 | |
266 | The bot will join @code{#bar} and will not set any modes nor will it |
267 | attempt to maintain any modes. |
268 | |
528799bd |
269 | @node bot.users, bot.shit, bot.conf, Configuration Files |
270 | @subsection bot.users (User List) |
c8f13c06 |
271 | |
272 | @file{bot.users} is the default file name of the userlist. It may be |
528799bd |
273 | changed in @file{bot.conf}. You must add an entry for yourself |
274 | manually. You will probably want to add other entries using the IRC |
275 | command interface as it is more intuitive than editing the file by |
276 | hand. |
277 | |
278 | The file contains lines with the format: |
c8f13c06 |
279 | |
528799bd |
280 | @samp{@var{host_mask}:@var{channel_mask}:@var{level}:@var{protection}:@var{auto-op}:@var{expiration}:@var{password}} |
c8f13c06 |
281 | |
282 | @itemize |
283 | |
528799bd |
284 | @item @var{host_mask} is the host mask |
c8f13c06 |
285 | (e.g. @samp{*!*username@*.domain.com}) of the user |
286 | |
528799bd |
287 | @item @var{channel_mask} is a channel mask of the channels that the user |
c8f13c06 |
288 | has priviliges to use the bot in (e.g. @samp{*} for all channels, |
289 | @samp{#*} for all non-local channel, @samp{#foo*} for all channels |
290 | starting with ``foo,'' @samp{#bar} for channel ``#bar'' only, etc.) |
291 | |
292 | @item @var{level} is the user level of the user (@ref{User Levels}). |
293 | |
294 | @item @var{protection} is the protection level of the user |
295 | (@ref{Protection}). |
296 | |
297 | @item @var{auto-op} is set to control whether a user is automatically |
298 | given operator priviliges on channel entry (@ref{Automatic Op}). |
299 | |
528799bd |
300 | @item @var{expiration} is the UNIX timestamp of when the user entry |
301 | becomes invalid. Setting this to -1 will make the entry permanent. |
302 | |
303 | @item @var{password} is the password the user must supply to the bot |
304 | to authenticate. This can be set to @code{*NONE*} to not have a password. |
305 | |
306 | @end itemize |
307 | |
308 | @node bot.shit, , bot.users, Configuration Files |
309 | @subsection bot.shit (Ban/Shit List) |
310 | |
311 | This file stores the ban list. The name may be changed in |
312 | @file{bot.conf}. You will most likely want to use the IRC command |
313 | interface to edit this file instead of editing it directly. |
314 | |
315 | The file contains lines in the form: |
316 | |
317 | @samp{@var{host_mask}:@var{channel_mask}:@var{level}:@var{expiration}:@var{reason}} |
318 | |
319 | @itemize |
320 | |
321 | @item @var{host_mask} is the host mask |
322 | (e.g. @samp{*!*username@*.domain.com}) of the user |
323 | |
324 | @item @var{channel_mask} is a channel mask of the channels that the user |
325 | is banned on (e.g. @samp{*} for all channels, |
326 | @samp{#*} for all non-local channel, @samp{#foo*} for all channels |
327 | starting with ``foo,'' @samp{#bar} for channel ``#bar'' only, etc. |
328 | |
329 | @item @var{level} is a number specifying if the bot should not allow |
330 | the user to gain ops, to kick the user upon joining, or to prevent the |
331 | user from being debanned by other users. @ref{Shit Levels} for |
332 | information on the available levels. |
333 | |
334 | @item @var{expiration} is the UNIX timestamp of when the shit entry |
335 | becomes invalid. This may be set to -1 to make it valid forever. |
336 | |
337 | @item @var{reason} is text that is sent to the user when they are |
338 | kicked or banned from the channel. |
339 | |
c8f13c06 |
340 | @end itemize |
341 | |
e07b6b46 |
342 | @node Using the Bot, Scripting, Configuration, Top |
343 | @chapter Using Bobot++ |
344 | |
345 | FIXME: stuff here... |
346 | |
347 | @menu |
6b59e728 |
348 | * Starting the Bot:: |
e07b6b46 |
349 | * User Levels:: |
c8f13c06 |
350 | * Protection:: |
351 | * Automatic Op:: |
528799bd |
352 | * Shit Levels:: |
6b59e728 |
353 | * Built-In Commands:: |
e07b6b46 |
354 | @end menu |
355 | |
6b59e728 |
356 | @node Starting the Bot, User Levels, Using the Bot, Using the Bot |
357 | @section Starting the Bot |
358 | |
359 | The bot is usually installed with the binary name @file{bobotpp}. It |
e45daca1 |
360 | accepts the following command line arguments. |
6b59e728 |
361 | |
362 | @itemize |
6b59e728 |
363 | @item @code{[--help][-h]} - Shows detailed help and exits |
6b59e728 |
364 | @item @code{[--version][-v]} - Shows version information and exits |
6b59e728 |
365 | @item @code{[--no-background][-b]} - Run bobot++ in the foreground |
9efc3706 |
366 | @item @code{[--config-file file][-f]} - Use file instead of @file{bot.conf} |
367 | @item @code{[--config-dir dir][-d]} - Use dir as dir to load config file from |
6b59e728 |
368 | @item @code{[--config dir][-c]} - Search your config path (defaults to |
369 | @file{@var{$HOME}/.bobotpp/config/} and then @file{/etc/bobotpp/}) for |
370 | dir and then loads your config data using dir |
6b59e728 |
371 | @item @code{[--sys-config dir][-s]} - Looks for config in |
372 | @file{/etc/bobotpp/dir}. Note that the user dir is still searched |
373 | first |
6b59e728 |
374 | @item @code{[--user-config dir][-u]} - Looks for config in |
375 | @file{@var{$HOME}/.bobotpp/config/dir/}. Note that the system dir is |
376 | still searched after this if dir is not found. |
6b59e728 |
377 | @item @code{[--debug][-D]} Makes Bobot++ print debugging info and run |
378 | in the foreground |
528799bd |
379 | @item @code{[--debug-scripts][-S]} Enables the Guile debugging |
4da877a5 |
380 | evaluator for verbose script errors and backtraces while still running |
381 | the bot in the background. |
6b59e728 |
382 | @end itemize |
383 | |
384 | The default configuration is read from |
385 | @file{@var{$HOME}/.bobotpp/config/default/} and then |
386 | @file{/etc/bobotpp/default/} if the user config is not found. |
387 | |
388 | The bot defaults to running in the background as a daemon. |
389 | |
390 | @node User Levels, Protection, Starting the Bot, Using the Bot |
e07b6b46 |
391 | @section User Levels |
392 | |
c8f13c06 |
393 | There are several user levels available in Bobot++ to provide gradated |
394 | access to commands. @command{!adduser} and @file{bot.users} use the |
395 | numeric code; Scheme uses the textual name for the level. By default |
e45daca1 |
396 | (if the user is not found in the userlist) a user has access to |
397 | commands with the level @code{bot:user-none}. |
c8f13c06 |
398 | |
399 | @enumerate 0 |
400 | |
401 | @item @code{bot:user-none} - No @strong{built-in} commands may be |
402 | executed @emph{by default} (commands may be added from Scheme that can |
403 | be executed by users of level none and the level required to execute a |
404 | command may be changed from Scheme). |
405 | |
406 | @item @code{bot:user-user} - Will be able to execute most commands but |
407 | not all and cannot use masks on kicks and bans. |
408 | |
409 | @item @code{bot:user-trusted} - For built-ins with a default |
410 | configuration this user has access to the same set of commands as an |
411 | @code{user} but may use masks on kicks and bans. Scheme commands may |
412 | be added which require a user to be of this level. |
413 | |
414 | @item @code{bot:user-friend} - In the default configuration a user who |
415 | is a friend will be able to do everything short of stopping the |
416 | bot. Again, there may be user added commands that require a higher |
417 | user level. |
418 | |
419 | @item @code{bot:user-master} - This is the highest user level and has |
420 | access to every feature of the bot. |
421 | |
422 | @end enumerate |
423 | |
424 | @node Protection, Automatic Op, User Levels, Using the Bot |
425 | @section Protection |
426 | |
427 | A user added via Scheme, the @file{bot.users} file, or |
428 | @command{!adduser} may be protected from being deoped, kicked, or |
e45daca1 |
429 | banned. The user list and IRC commands use the numeric codes, Scheme |
430 | uses the symbolic names. |
c8f13c06 |
431 | |
432 | @enumerate 0 |
e45daca1 |
433 | @item @code{bot:protection/none} No protection |
434 | @item @code{bot:protection/no-ban} No ban. If a user is banned the bot will unban him.. |
435 | @item @code{bot:protection/no-kick} No kick. The user may still be kicked but the bot will kickban |
c8f13c06 |
436 | the user who kicked the protected user. |
e45daca1 |
437 | @item @code{bot:protection/no-deop} No deop. The bot will ensure that the user always maintains |
c8f13c06 |
438 | operator status. |
c8f13c06 |
439 | @end enumerate |
440 | |
528799bd |
441 | @node Automatic Op, Shit Levels, Protection, Using the Bot |
c8f13c06 |
442 | @section Automatic Op |
443 | |
444 | A user may be automatically given operator status upon entering a |
e45daca1 |
445 | channel. Scheme uses the symbolic name, the user list |
446 | (@file{bot.users}) and IRC commands use the numeric value. |
447 | |
448 | @enumerate 0 |
449 | @item @code{bot:aop/no} Do not automatically op the user |
450 | @item @code{bot:aop/yes} Do automatically op the user |
451 | @end enumerate |
e07b6b46 |
452 | |
528799bd |
453 | @node Shit Levels, Built-In Commands, Automatic Op, Using the Bot |
454 | @section Shit Levels |
455 | |
456 | The shit list and shit list related commands use different levels to |
457 | define how much the bot hates a user. Scheme uses the symbolic names, |
458 | the shit list and IRC commands use the numbers. |
459 | |
460 | @enumerate 0 |
461 | @item @code{bot:shit/none} The bot doesn't hate the user (this is the |
462 | normal level) |
463 | @item @code{bot:shit/no-op} The bot will deop the user any time he |
464 | gains operator priviliges in the channel |
465 | @item @code{bot:shit/no-join} The bot will kick and ban the user when he |
466 | joins the channel |
467 | @item @code{bot:shit/no-deban} The bot will kick and ban usre when he |
468 | joins the channel, and will prevent other users from debanning him. |
469 | @end enumerate |
470 | |
471 | @node Built-In Commands, , Shit Levels, Using the Bot |
6b59e728 |
472 | @section Built-In Commands |
473 | |
474 | Bobot++ has many built-in commands that make it useful without |
9efc3706 |
475 | scripting support. The reference leaves off the command char; remember |
476 | to use whatever you defined the command char to be in |
6b59e728 |
477 | @file{bot.conf}. If a command needs the channel name then you must |
478 | specify the channel as the first argument to the command when private |
479 | messaging the bot a command. |
480 | |
9efc3706 |
481 | @multitable @columnfractions 0.20 0.15 0.15 0.50 |
6b59e728 |
482 | @item @sc{command} @tab @sc{Needs Channel} @tab @sc{Min Level to Use} @tab @sc{Description} |
483 | |
484 | @item @command{action} @option{do} @tab Yes @tab @var{USER} @tab |
485 | Causes the bot to perform the action @option{do} in the current |
486 | channel. |
487 | |
9efc3706 |
488 | @item @command{adduser} @tab @tab @tab |
6b59e728 |
489 | |
9efc3706 |
490 | @item @command{addserver} @tab @tab @tab Adds the server specified by |
491 | @var{host name} or @var{ip address} to the server list. |
6b59e728 |
492 | |
9efc3706 |
493 | @item @command{addshit} @tab @tab @tab |
6b59e728 |
494 | |
9efc3706 |
495 | @item @command{alias} @tab @tab @tab Makes an alias, and adds the |
496 | function @var{new name}, that will do exactly the same command as |
497 | @var{old name}. |
6b59e728 |
498 | |
9efc3706 |
499 | @item @command{ban} @tab @tab @tab Bans @var{mask} or @var{nick} from |
500 | @var{channel}. You need to be a trusted user to ban with a |
501 | @var{mask}. |
6b59e728 |
502 | |
9efc3706 |
503 | @item @command{banlist} @tab @tab @tab |
6b59e728 |
504 | |
9efc3706 |
505 | @item @command{channels} @tab @tab @tab Prints the channel(s) where |
506 | the bot is currently. |
6b59e728 |
507 | |
9efc3706 |
508 | @item @command{cycle} @tab Yes @tab @tab Makes the bot leave and join |
509 | @var{channel}. |
6b59e728 |
510 | |
9efc3706 |
511 | @item @command{dcclist} @tab @tab @tab Gives the list of all DCC Chat |
512 | connections. |
6b59e728 |
513 | |
9efc3706 |
514 | @item @command{deban} @tab Yes @tab @tab Debans @var{mask} or |
515 | @var{nick} from @var{channel}. You need to be a trusted user to deban |
516 | with a @var{mask}. |
6b59e728 |
517 | |
9efc3706 |
518 | @item @command{delserver} @tab @tab @tab Deletes server from server |
519 | list whose number in the server list is @var{server number}. |
6b59e728 |
520 | |
9efc3706 |
521 | @item @command{deluser} @tab @tab @tab Removes @var{nick} or |
522 | @var{mask} from the userlist. |
6b59e728 |
523 | |
9efc3706 |
524 | @item @command{delshit} @tab @tab @tab Removes @var{nick} or |
525 | @var{mask} from the shitlist. |
6b59e728 |
526 | |
9efc3706 |
527 | @item @command{deop} @tab Yes @tab @tab Deops @var{mask} or @var{nick} |
528 | on @var{channel}. |
6b59e728 |
529 | |
9efc3706 |
530 | @item @command{die} @tab @tab @tab Makes the bot stop immediately. |
6b59e728 |
531 | |
9efc3706 |
532 | @item @command{do} @tab @tab @tab |
6b59e728 |
533 | |
9efc3706 |
534 | @item @command{execute} @tab @tab @tab @strong{Only available if |
535 | scripting support is enabled} |
6b59e728 |
536 | |
9efc3706 |
537 | @item @command{help} @tab @tab @tab |
6b59e728 |
538 | |
9efc3706 |
539 | @item @command{ident} @tab @tab @tab Identifies you on the bot. Note |
540 | that you should not use this command in public @dots{} |
6b59e728 |
541 | |
9efc3706 |
542 | @item @command{invite} @tab Yes @tab @tab Invites @var{nick} on |
543 | @var{channel}. |
6b59e728 |
544 | |
9efc3706 |
545 | @item @command{join} @tab @tab @tab Makes the bot join @var{channel}. |
6b59e728 |
546 | |
9efc3706 |
547 | @item @command{keep} @tab Yes @tab @tab Sets the @var{modes} that the |
548 | bot will keep for @var{channel}. |
6b59e728 |
549 | |
9efc3706 |
550 | @item @command{kick} @tab Yes @tab @tab Kicks @var{mask} or @var{nick} |
551 | out of @var{channel}, because of @var{reason}. You need to be a |
552 | trusted user to use a @var{mask}. |
6b59e728 |
553 | |
9efc3706 |
554 | @item @command{kickban} @tab Yes @tab @tab Bans then kicks @var{mask} |
555 | or @var{nick} out of @var{channel}, because of @var{reason}. You need |
556 | to be a trusted user to use a @var{mask}. |
6b59e728 |
557 | |
9efc3706 |
558 | @item @command{load} @tab @tab @tab Reloads the userlist from disk. |
6b59e728 |
559 | |
9efc3706 |
560 | @item @command{loadscript} @tab @tab @tab @strong{Only available if |
561 | scripting support is enabled} |
6b59e728 |
562 | |
9efc3706 |
563 | @item @command{lock} @tab @tab @tab Locks topic on @var{channel}. |
6b59e728 |
564 | |
9efc3706 |
565 | @item @command{mode} @tab Yes @tab @tab Sends @var{mode string} as |
566 | mode for @var{channel}. |
6b59e728 |
567 | |
9efc3706 |
568 | @item @command{msg} @tab @tab @tab |
6b59e728 |
569 | |
9efc3706 |
570 | @item @command{names} @tab Yes @tab @tab Shows the nicknames and |
571 | status of users on @var{channel}. |
6b59e728 |
572 | |
9efc3706 |
573 | @item @command{nextserver} @tab @tab @tab Makes the bot connect to the |
574 | next server in its server list. |
6b59e728 |
575 | |
9efc3706 |
576 | @item @command{nick} @tab @tab @tab Makes the bot use nickname @var{nick}. |
6b59e728 |
577 | |
9efc3706 |
578 | @item @command{nslookup} @tab @tab @tab Does a nameserver query about |
579 | @var{nick} host, @var{host} or @var{ip address}. |
6b59e728 |
580 | |
9efc3706 |
581 | @item @command{op} @tab Yes @tab @tab Ops @var{nick} on @var{channel}. |
6b59e728 |
582 | |
9efc3706 |
583 | @item @command{part} @tab Yes @tab @tab Makes the bot leave @var{channel}. |
6b59e728 |
584 | |
9efc3706 |
585 | @item @command{password} @tab @tab @tab Changes your password on the |
586 | bot. Use @code{NONE} as password if you want to clear it. Do not use this |
587 | command in public! |
6b59e728 |
588 | |
9efc3706 |
589 | @item @command{reconnect} @tab @tab @tab Makes the bot reconnect to |
590 | its current server. |
6b59e728 |
591 | |
9efc3706 |
592 | @item @command{rspymessage} @tab @tab @tab Removes you from the spy |
593 | list. |
6b59e728 |
594 | |
9efc3706 |
595 | @item @command{save} @tab @tab @tab Saves the userlist. |
6b59e728 |
596 | |
9efc3706 |
597 | @item @command{say} @tab Yes @tab @tab Makes the bot say @var{message} |
598 | on @var{channel}. |
6b59e728 |
599 | |
9efc3706 |
600 | @item @command{server} @tab @tab @tab Select the server to connect |
601 | to. @var{server number} is the number of the server in the serverlist. |
6b59e728 |
602 | |
9efc3706 |
603 | @item @command{serverlist} @tab @tab @tab Shows the bot's serverlist. |
6b59e728 |
604 | |
9efc3706 |
605 | @item @command{setfloodrate} @tab @tab @tab |
6b59e728 |
606 | |
9efc3706 |
607 | @item @command{setversion} @tab @tab @tab |
6b59e728 |
608 | |
9efc3706 |
609 | @item @command{shitlist} @tab @tab @tab Shows the bot's shitlist. |
6b59e728 |
610 | |
9efc3706 |
611 | @item @command{spylist} @tab @tab @tab Shows the bot's spylist. |
6b59e728 |
612 | |
9efc3706 |
613 | @item @command{spymessage} @tab @tab @tab Adds you to the spylist |
6b59e728 |
614 | |
9efc3706 |
615 | @item @command{stats} @tab Yes @tab @tab Gives @var{channel}'s statistics. |
6b59e728 |
616 | |
9efc3706 |
617 | @item @command{tban} @tab Yes @tab @tab Bans @var{nick} or @var{mask} |
618 | from @var{channel} for @var{time} seconds. |
6b59e728 |
619 | |
9efc3706 |
620 | @item @command{tkban} @tab Yes @tab @tab Bans @var{nick} or @var{mask} |
621 | from @var{channel} for @var{time} seconds, then kicks him/them because |
622 | of @var{reason}. |
6b59e728 |
623 | |
9efc3706 |
624 | @item @command{topic} @tab Yes @tab @tab If no @var{topic}is given, |
625 | prints @var{channel}'s topic. Otherwise, the bot will change |
626 | @var{channel}'s topic to @var{topic}. |
6b59e728 |
627 | |
9efc3706 |
628 | @item @command{unlock} @tab Yes @tab @tab Makes the bot unlock topic |
629 | on @var{channel} |
6b59e728 |
630 | |
9efc3706 |
631 | @item @command{userlist} @tab @tab @tab Shows the bot's userlist |
6b59e728 |
632 | |
9efc3706 |
633 | @item @command{who} @tab Yes @tab @tab Show your level on @var{channel} |
6b59e728 |
634 | |
9efc3706 |
635 | @item @command{whois} @tab Yes @tab @tab Shows information about |
636 | @var{nick} on @var{channel} |
6b59e728 |
637 | |
638 | @end multitable |
639 | |
e07b6b46 |
640 | @node Scripting, Concept Index, Using the Bot, Top |
31433d27 |
641 | @chapter Scripting |
642 | |
643 | Bobot++'s most powerful feature is its scripting system. You write |
644 | scripts using Guile Scheme. This manual does not cover how to use |
ad529fde |
645 | Guile or how to learn Scheme. @xref{Top, , Guile Reference Manual, |
646 | guile, The Guile Reference Manual}, for the Guile reference manual and |
31433d27 |
647 | @url{http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html} for |
648 | a good tutorial on Scheme. |
649 | |
439869bf |
650 | Note that in previous versions the scripting commands where in the |
651 | form @code{bot-@var{function}}. They are now in the form |
652 | @code{bot:@var{function}}. The old names are still available, but are |
c8f13c06 |
653 | deprecated and will be removed in Bobot++ 3.0. New commands are only |
654 | available with the @code{bot:} prefix. The command @command{perl -pi |
655 | -e ``s/bot-/bot:/g'' @var{your-files}} should be enough to convert |
656 | your code to use the new functions. |
439869bf |
657 | |
ae97d6ec |
658 | @strong{NOTE}: All arguments to functions and hooks called by the bot |
659 | are strings unless otherwise specified. |
660 | |
439869bf |
661 | @menu |
662 | * Adding New Commands:: |
663 | * Hooks:: |
e07b6b46 |
664 | * Sending Messages:: |
91dddabd |
665 | * Misc Scripting Stuff:: |
439869bf |
666 | @end menu |
667 | |
668 | @node Adding New Commands, Hooks, Scripting, Scripting |
669 | @section Adding New Commands |
670 | |
02341ea9 |
671 | Adding a new command is simple. To register a new command use |
672 | @code{bot:addcommand}. |
9efc3706 |
673 | |
674 | @defun bot:addcommand name func needs-channel? num-of-args min-level |
675 | |
676 | The @var{name} is a string representing the name of the command being |
677 | added. @var{func} is a function accepting @var{num-of-args} |
678 | arguments. @var{needs-channel?} is a bool that is true if the function |
679 | needs the channel name as its first arg, and false otherwise. |
680 | @var{num-of-args} is the number of args @var{func} will take and must |
681 | be within zero (0) and twenty (20). @var{min-level} is one of the |
528799bd |
682 | @ref{User Levels}. A user must be at least a @var{min-level} user to |
683 | use the new command. None of the arguments are guaranteed to be |
684 | passed; if they aren't they are set to the empty string @code{""}. An |
685 | example of a new command would be: |
fed59248 |
686 | |
687 | @example |
e07b6b46 |
688 | (define (hello channel name) |
fed59248 |
689 | (if (string=? name "") |
e07b6b46 |
690 | (bot:say channel "Hello world!") |
691 | (bot:say channel (string-append "Hello " name "!"))) |
692 | |
693 | (bot:addcommand "hello" hello #t 2 0) |
fed59248 |
694 | @end example |
695 | |
e07b6b46 |
696 | This will display ``Hello World!'' if called as @kbd{!hello} and |
ae97d6ec |
697 | ``Hello World @var{USER}'' if called as @kbd{!hello @var{USER}}. |
9efc3706 |
698 | @end defun |
e07b6b46 |
699 | |
528799bd |
700 | @node Hooks, Sending Messages, Adding New Commands, Scripting |
439869bf |
701 | @section Hooks |
702 | |
e07b6b46 |
703 | @cindex Background on Hooks |
439869bf |
704 | Hooks are a powerful feature of Bobot++. Hooks are a hybrid of ircII |
fed59248 |
705 | and tiny fugue (a MUD bot) hooks with a little bit of extra stuff |
02341ea9 |
706 | added in. A hook is called when a regular expression is matched |
707 | against a message sent to or by the bot. |
708 | |
709 | Bobot++ uses different hook types for each IRC message type, and also |
710 | includes a hook for accessing raw irc messages. Hooks are tagged with |
711 | a priority and a flag that specifies whether to call the next hook |
712 | that matches after calling the current one or to stop |
713 | processing. |
714 | |
715 | Hooks are processed from the highest to lowest priority, with |
716 | fallthrough hooks of equal priority to non-fallthrough hooks being |
717 | executed first. |
439869bf |
718 | |
719 | @menu |
720 | * Creating a Hook:: |
721 | * Hook Types:: |
722 | @end menu |
723 | |
724 | @node Creating a Hook, Hook Types, Hooks, Hooks |
725 | @subsection Creating a Hook |
726 | |
9efc3706 |
727 | To add a new hook you use the function @code{bot:addhook}. |
728 | |
729 | @defun bot:addhook type regex function [pri fall name] |
730 | @var{type} specifies the type of hook (the types of hooks are listed |
ae97d6ec |
731 | in @ref{Hook Types}). |
732 | |
733 | @var{regex} is a standard regular expression. If |
734 | @var{regex} is matched, @var{function} will be called. |
735 | |
736 | @var{function} will take a different number of args depending on the |
737 | hook type. |
738 | |
739 | @var{pri} specifies the priority of the hook---higher priority hooks |
740 | are executed first. This argument is optional and defaults to |
741 | @code{0}. |
742 | |
743 | @var{fall} is @code{#t} if the hook is a fallthrough hook and |
744 | @code{#f} is the hook is not a fallthrough hook. This arg is also |
745 | optional and defaults to @code{#t}. |
746 | |
747 | @var{name} is the optional name of the hook that defaults to |
748 | @code{"DEFAULT"}. If you set the name then you can have more than |
749 | one hook that matches the same regexp, as long as they have the same |
750 | name. E.g. in a log script you could have the regexps for the log |
751 | function all be @code{".*"} and set their names to @code{"log"} to |
752 | avoid a conflict with other hooks. |
9efc3706 |
753 | @end defun |
439869bf |
754 | |
755 | @node Hook Types, , Creating a Hook, Hooks |
756 | @subsection Hook Types |
757 | |
ae97d6ec |
758 | The following sections document the different hooks Bobot++ exposes. |
759 | |
760 | The general format of each hook description is as if it were a |
c99c411a |
761 | function to be defined, but these describe the function to be passed |
9efc3706 |
762 | to @code{bot:add-hook}. Do @emph{not} name your functions these |
763 | names. |
439869bf |
764 | |
9efc3706 |
765 | That said, here is the list of available hooks functions. |
766 | FIXME: write docs |
767 | |
ae97d6ec |
768 | @menu |
769 | * Received Message Hooks:: |
770 | * Sent Message Hooks:: |
771 | * DCC CHAT Hooks:: |
772 | * Miscellaneous Hooks:: |
773 | @end menu |
774 | |
775 | @node Received Message Hooks, Sent Message Hooks, Hook Types, Hook Types |
776 | @subsubsection Receieved Message Hooks |
777 | |
778 | The following hooks are triggered when a mesage is received by the bot. |
779 | |
9efc3706 |
780 | @defun hooks/action from to action |
ae97d6ec |
781 | This hook is triggered when someone performs an action. |
782 | |
783 | @var{from} is the nickname the person that performed the |
784 | action. |
785 | |
9efc3706 |
786 | @var{to} is the target of the action, which is either a channel or the |
ae97d6ec |
787 | Bot's nick if the user private messages the bot. |
439869bf |
788 | |
ae97d6ec |
789 | @var{action} is the text of the action. E.g. if someone did @samp{* |
790 | foobar does baz}, then @var{action} would be the string @code{"does |
791 | baz"}. |
792 | @end defun |
439869bf |
793 | |
9efc3706 |
794 | @defun hooks/nickname old-nick new-nick |
ae97d6ec |
795 | This hook is called when someone changes his nickname from |
9efc3706 |
796 | @var{old-nick} to @var{new-nick}. |
797 | @end defun |
439869bf |
798 | |
ae97d6ec |
799 | @defun hooks/signoff nick message |
800 | This hook is called when someone signs off of IRC. |
801 | |
802 | @var{nick} is the nickname of the person signing off. |
803 | |
804 | @var{message} is his quit message |
9efc3706 |
805 | @end defun |
439869bf |
806 | |
9efc3706 |
807 | @defun hooks/ctcp nick to command rest |
ae97d6ec |
808 | This hook is called when a CTCP request is received by the bot. |
809 | |
810 | @var{nick} is the nickname of the sender. |
811 | |
812 | @var{to} is the target of the CTCP request. This will either be a |
813 | channel the bot is in, or the nickname of the bot. |
814 | |
815 | @var{command} is the CTCP command issued. |
816 | |
817 | @var{rest} contains the arguments to the CTCP command. |
9efc3706 |
818 | @end defun |
439869bf |
819 | |
9efc3706 |
820 | @defun hooks/ctcp-reply nick command rest |
ae97d6ec |
821 | This hook is called when a CTCP REPLY is received. This occurs when |
822 | the bot has sent a CTCP request to another client. The CTCP REPLY is |
823 | always addressed to the bot directly. |
824 | |
825 | @var{nick} is the nickname of the person who replied. |
826 | |
827 | @var{command} is the command to which @var{nick} is replying. |
439869bf |
828 | |
ae97d6ec |
829 | @var{rest} contains the body of the reply. |
9efc3706 |
830 | @end defun |
439869bf |
831 | |
ae97d6ec |
832 | @defun hooks/disconnect server intentional |
833 | This is called when the bot is disconnected from a server. |
834 | |
835 | @var{server} is the hostname of the server from which the bot was |
836 | disconnected. |
837 | |
838 | @var{intentional} is a flag set to @code{#t} when the bot disonnected |
839 | from the server as the result of a command (issued by a user from IRC, |
840 | SIGHUP, or from a script), or @code{#f} when the bot disconnected from |
841 | the server unintentionally.. |
9efc3706 |
842 | @end defun |
439869bf |
843 | |
9efc3706 |
844 | @defun hooks/invite nick channel |
ae97d6ec |
845 | This hook is called when a user invited the bot to join a channel. |
846 | |
847 | @var{nick} is the nickname of the user who sent the invite. |
848 | |
849 | @var{channel} is the channel to which the bot was invited. |
9efc3706 |
850 | @end defun |
439869bf |
851 | |
9efc3706 |
852 | @defun hooks/join nick channel |
ae97d6ec |
853 | This is called when a user or the bot joins a channel. |
854 | |
855 | @var{nick} is the nickname of the user who joined @var{channel}. This |
856 | may be the bot's nickname (the IRC server sends the JOIN command back |
857 | to the the bot after it joins a channel). |
858 | |
859 | @var{channel} is the channel that was joined |
9efc3706 |
860 | @end defun |
439869bf |
861 | |
9efc3706 |
862 | @defun hooks/kick target from channel reason |
ae97d6ec |
863 | This hook is called when a user, including the bot, is kicked out of a |
864 | channel. |
865 | |
866 | @var{target} is the nick of the user who was kicked. This may be the |
867 | bot's nick. |
868 | |
869 | @var{from} is the nick of the user who issued the kick. This may also |
870 | be the bot's nick. |
871 | |
872 | @var{channel} is the channel the kick was issued in. |
873 | |
874 | @var{reason} is the reason the user was kicked. |
9efc3706 |
875 | @end defun |
439869bf |
876 | |
ae97d6ec |
877 | @defun hooks/part nick channel |
878 | This hook is called when a user parts a channel. |
879 | |
880 | @var{nick} is the user who parted the channel. This may be the bot. |
881 | |
882 | @var{channel} is the channel from which the user parted. |
9efc3706 |
883 | @end defun |
439869bf |
884 | |
ae97d6ec |
885 | @defun hooks/mode nick target modes |
886 | This hook is called when someone sets the modes of @var{target}. |
887 | |
888 | @var{nick} is the user who set the modes. This may be the bot. |
889 | |
890 | @var{target} is the target of the MODE command. This may be a |
891 | channel or a user. If it is a user, it may be the bot. |
892 | |
893 | @var{modes} is the MODE string. |
9efc3706 |
894 | @end defun |
439869bf |
895 | |
ae97d6ec |
896 | @defun hooks/message nick message |
897 | This hook is called when someone sends a private message to the bot. |
898 | |
899 | @var{nick} is the nickname of the user who sent the message. |
900 | |
901 | @var{message} is the message the user sent. |
9efc3706 |
902 | @end defun |
439869bf |
903 | |
9efc3706 |
904 | @defun hooks/notice nick message |
ae97d6ec |
905 | This hook is called when a user send a private notice to the bot. |
906 | |
907 | @var{nick} is the user who sent the notice. |
908 | |
909 | @var{message} is the message the user sent. |
9efc3706 |
910 | @end defun |
439869bf |
911 | |
ae97d6ec |
912 | @defun hooks/public nick channel message |
913 | This hook is called when a user sends a normal message to a channel. |
914 | |
915 | @var{nick} is the user who sent the message. |
916 | |
917 | @var{channel} is the channel to which the message was sent. |
918 | |
919 | @var{message} is the message that was sent. |
9efc3706 |
920 | @end defun |
439869bf |
921 | |
ae97d6ec |
922 | @defun hooks/public-notice nick channel message |
923 | This hook is called when a user send a notice to a channel. |
924 | |
925 | @var{nick} is the user who sent the notice. |
926 | |
927 | @var{channel} is the channel to which the notice was sent. |
928 | |
929 | @var{message} is the message that was sent. |
9efc3706 |
930 | @end defun |
439869bf |
931 | |
9efc3706 |
932 | @defun hooks/raw raw-message |
ae97d6ec |
933 | This hook is called every time a message is received. This matches on |
934 | the raw message text and passes the hook function the raw IRC message. |
439869bf |
935 | |
ae97d6ec |
936 | @var{raw-message} is the raw IRC message. |
9efc3706 |
937 | @end defun |
439869bf |
938 | |
9efc3706 |
939 | @defun hooks/topic nick channel new-topic |
ae97d6ec |
940 | This hook is called when a user changes the topic in a channel. |
941 | |
942 | @var{nick} is the user who set the topic. This may be the bot. |
943 | |
944 | @var{channel} is the channel that's topic was changed. |
945 | |
946 | @var{new-topic} is the new topic. |
9efc3706 |
947 | @end defun |
0b7a49e2 |
948 | |
ae97d6ec |
949 | @node Sent Message Hooks, DCC CHAT Hooks, Received Message Hooks, Hook Types |
950 | @subsubsection Sent Message Hooks |
951 | |
952 | These hooks are called when the bot sends a message. @var{mynick} is |
953 | always the bot's nick and will not be documented in each hook |
954 | description. |
955 | |
956 | @defun hooks/send/public mynick channel message |
957 | This hook is called when the bot sends a normal message to a channel. |
958 | |
959 | @var{channel} is the channel to which the bot sent the message. |
960 | |
961 | @var{message} is the message the bot sent. |
9efc3706 |
962 | @end defun |
963 | |
ae97d6ec |
964 | @defun hooks/send/message mynick to message |
965 | This hook is called when the bot sends a private message to a user. |
966 | |
967 | @var{to} is the nick of the user to whom the message was sent. |
968 | |
969 | @var{message} is the message that was sent. |
9efc3706 |
970 | @end defun |
439869bf |
971 | |
9efc3706 |
972 | @defun hooks/send/action mynick to message |
ae97d6ec |
973 | This hook is called when the bot sents an action to a channel or a |
974 | user. |
975 | |
976 | @var{to} is the channel or nick of the user to which the action was |
977 | sent. |
978 | |
979 | @var{message} is the text of the action. |
9efc3706 |
980 | @end defun |
981 | |
982 | @defun hooks/send/ctcp mynick to command message |
ae97d6ec |
983 | This hook is called when the bot sends a CTCP message @emph{other |
984 | than} an ACTION to a channel or user. |
985 | |
986 | @var{to} is the channel or nick of the user to which the CTCP was |
987 | sent. |
988 | |
989 | @var{command} is the CTCP command that was sent. |
990 | |
991 | @var{message} is a string containing the arguments to the CTCP command. |
9efc3706 |
992 | @end defun |
993 | |
528799bd |
994 | @defun hooks/send/who who |
995 | This is called when the bot sends a WHO message. The regex is matched |
996 | on @var{who}, which is also passed as the only argument to your |
997 | function. |
998 | |
999 | @var{who} is the channel or nick that was WHOed. |
1000 | @end defun |
1001 | |
1002 | @defun hooks/send/whois nick |
1003 | This is called when the bot sends a WHOIS message. The regex is |
1004 | matched on @var{nick}, which is also passed as the only argument to |
1005 | your function. |
1006 | |
1007 | @var{nick} is the nickname of the person who was WHOISed. |
1008 | @end defun |
1009 | |
ae97d6ec |
1010 | @node DCC CHAT Hooks, Miscellaneous Hooks, Sent Message Hooks, Hook Types |
1011 | @subsubsection DCC CHAT Hooks |
1012 | |
1013 | These hooks are called when a user initializes a DCC CHAT and when the |
1014 | bot receives messages from the user in a DCC CHAT. |
1015 | |
9efc3706 |
1016 | @defun hooks/dcc/chat-begin from |
ae97d6ec |
1017 | This hook is called when a user begins a DCC CHAT with the bot. |
9efc3706 |
1018 | @var{from} is the user's address in the form @samp{nick!user@@host}. |
1019 | @end defun |
1020 | |
133eff7a |
1021 | @defun hooks/dcc/chat-end address |
1022 | This hook is called when a DCC CHAT is purged after being idle for a |
1023 | while, or when the user closes the DCC CHAT. As such, you cannot write |
1024 | any more data to the DCC CHAT. |
1025 | |
1026 | @var{address} is the address (nick!user@@host) of the person on the |
1027 | other side of the DCC. |
1028 | @end defun |
1029 | |
9efc3706 |
1030 | @defun hooks/dcc/chat-message from message |
ae97d6ec |
1031 | This hook is called when a user sends a message to the bot through |
1032 | a DCC CHAT. |
1033 | |
1034 | @var{from} is the user's address in the form @samp{nick!user@@host}. |
1035 | |
1036 | @var{message} is the message the user sent to the bot. |
1037 | @end defun |
1038 | |
1039 | @node Miscellaneous Hooks, , DCC CHAT Hooks, Hook Types |
1040 | @subsubsection Miscellaneous Hooks |
1041 | |
1042 | @defun hooks/flood nick |
1043 | This hook is called when a user is detected flooding the bot. |
1044 | |
1045 | @var{nick} is the nickname of the user flooding the bot. |
1046 | @end defun |
1047 | |
1048 | @defun hooks/timer time |
1049 | This hook is called once a minute. The regex is @strong{not} used. |
1050 | |
1051 | @var{time} is the in zero-padded @code{hh:mm} format. |
9efc3706 |
1052 | @end defun |
439869bf |
1053 | |
528799bd |
1054 | |
1055 | @node Sending Messages, Misc Scripting Stuff, Hooks, Scripting |
e07b6b46 |
1056 | @section Sending Messages |
1057 | |
1058 | There are several types of messages you can send with Bobot++ from |
528799bd |
1059 | scripts. They are split into High and Low level message sending |
1060 | functions. Most bots will only use the high level functions, but the |
1061 | low level ones are provided for when a bot needs to do things like |
1062 | send raw IRC messages or CTCP commands. |
e07b6b46 |
1063 | |
1064 | @menu |
1065 | * High Level Message Functions:: |
1066 | * Low Level Message Functions:: |
1067 | @end menu |
1068 | |
1069 | @node High Level Message Functions, Low Level Message Functions, Sending Messages, Sending Messages |
1070 | @subsection ``High Level'' Message Functions |
1071 | |
9efc3706 |
1072 | @defun bot:say channel message |
1073 | Send a public or private @var{message} to @var{channel}. |
1074 | |
1075 | Sends a normal text message, as if a user had typed it in. The |
1076 | @var{dest} can be a nickname or a channel. |
1077 | @end defun |
1078 | |
1079 | @defun bot:action channel message |
1080 | Send an ``action'' type @var{message} to @var{channel} |
1081 | @end defun |
1082 | |
528799bd |
1083 | |
1084 | @defun bot:msg target message |
1085 | @defunx bot:say target message |
1086 | Send a public or private message to @var{target}. |
1087 | |
1088 | @var{target} may be a channel or a nickname. |
1089 | |
1090 | In versions of Bobot++ prior to 2.1.8 @code{bot:say} could only send |
1091 | to channels, and @code{bot:msg} could only send private messages to |
1092 | users. They are aliases of the same command now, but it may be worth |
1093 | using them as they used to for clarity. |
9efc3706 |
1094 | @end defun |
e07b6b46 |
1095 | |
5aec4622 |
1096 | @defun bot:notice target message |
1097 | Sends @var{message} as a NOTICE to @var{target}. @var{target} may be a |
528799bd |
1098 | user (nick) or a channel. |
5aec4622 |
1099 | @end defun |
1100 | |
e07b6b46 |
1101 | @node Low Level Message Functions, , High Level Message Functions, Sending Messages |
1102 | @subsection ``Low Level'' Message Functions |
1103 | |
9efc3706 |
1104 | @c Add a url for rfc2812 |
e07b6b46 |
1105 | The ``Low Level'' messaging functions allow you to do things like send |
1106 | CTCP messages. You probably want to read rfc 2812 and the CTCP spec |
1107 | before using these. If you have no idea what these do, read rfc 2812 |
1108 | (IRC Client Protocol) and CTCP spec. These functions all return |
9efc3706 |
1109 | @code{*unspecified*} always, so don't use the return value for |
1110 | anything. |
e07b6b46 |
1111 | |
c99c411a |
1112 | @defun bot:ctcp to command message |
1085f47c |
1113 | @var{to} is the target of your CTCP message, @var{command} is the |
1114 | CTCP command, and @var{message} is the message (or arguments) of the |
e07b6b46 |
1115 | command. Make sure to @code{bot:ctcp-quote} the message! |
9efc3706 |
1116 | @end defun |
e07b6b46 |
1117 | |
c99c411a |
1118 | @defun bot:ctcp-reply to command message |
1085f47c |
1119 | @var{to} is the target of your CTCP reply, @var{command} is the |
1120 | CTCP command, and @var{message} is the message (or arguments) of the |
672b7d4e |
1121 | command. Make sure to @code{bot:ctcp-quote} the message! |
1122 | |
1123 | This is used to reply to a ctcp that the bot has received. |
1124 | @end defun |
1125 | |
91dddabd |
1126 | @node Misc Scripting Stuff, , Sending Messages, Scripting |
1127 | @section Misc. Scripting Stuff |
1128 | |
1129 | These are a few useful things that I thought people writing scripts |
1130 | might want to know. |
1131 | |
fed59248 |
1132 | @vindex exit-hook |
91dddabd |
1133 | If you want to execute code when the bot exits, just do |
1134 | @code{add-hook! bot:exit-hook @var{thunk}} where @var{thunk} is an |
1135 | argumentless procedure (a thunk). When the bot exits your thunk will |
1136 | be called. |
1137 | |
9efc3706 |
1138 | @quotation |
1085f47c |
1139 | [ I didn't know where to put any of these, so I just stuck them in |
9efc3706 |
1140 | here. |
1141 | |
1142 | There probably needs to be several sections added, like dealing with |
1143 | users (kicking, added, etc), dealing with the bot (channels, nickname |
1144 | of the bot, etc), server issues (serverlist), useful tools (nslookup, |
1145 | whois), and do on. ] |
1146 | @end quotation |
1147 | |
1148 | |
1149 | @defun bot:adduser nick-or-mask cbannel-mask level prot auto-op |
1150 | Adds an user to the userlist, for a @code{nick!user@@host} matching the |
1151 | one given, on a channel matching the @var{channelMask} given. |
1152 | |
1153 | @multitable @columnfractions 0.33 0.33 0.33 |
1154 | @item The @var{level} can be: @tab The @var{prot} can be: @tab The @var{auto-op} can be: |
1155 | @item 0 - No level @tab 0 - No protection @tab 0 - No auto-op |
1156 | @item 1 - User @tab 1 - No ban @tab 1 - Op on join |
1157 | @item 2 - Trusted User @tab 2 - No kick @tab |
1158 | @item 3 - Friend @tab 3 - No deop @tab |
1159 | @item 4 - Master @tab @tab |
1160 | @end multitable |
1161 | |
1162 | @end defun |
1163 | |
1164 | @c (3, 4, 0) |
1165 | @defun bot:addserver hostname ip-address [portnumber] |
1166 | Adds the server specified by @var{hostname} or @var{ip-address} to |
1167 | the server list. |
1168 | @end defun |
1169 | |
1170 | @c (3, 2, 0) |
1171 | @defun bot:addshit nick-or-mask channel-mask level [time reason] |
1172 | Adds an user to the shitlist, for a nick!user@@host matching the |
1173 | one given, on a channel matching the @var{channelMask} given. |
1174 | |
1175 | @display |
1176 | The @var{level} can be: |
1177 | 0 - No shit |
1178 | 1 - No op |
1179 | 2 - Kick and Ban on join |
1180 | 3 - Kick and Ban on join, no deban |
1181 | @end display |
1182 | |
1183 | @end defun |
1184 | |
1185 | @c (2, 0, 0) |
1186 | @defun bot:ban channel mask-or-nick |
1187 | Bans @var{mask} or @var{nick} from @var{channel}. You need to be a trusted |
1188 | user to ban with a @var{mask}. |
1189 | @end defun |
1190 | |
1191 | @c (2, 0, 0) |
1192 | @defun bot:change-command-level nick-or-mask channel-mask new-level |
1193 | Gives @var{nick} or @var{mask} level @var{new-level} on channel(s) |
1194 | @var{channel-mask}. Note that you can not change level for someone |
1195 | whose level is greater than yours, and that you can not give a |
1196 | level greater than yours. |
1197 | @end defun |
1198 | |
1199 | @c (1, 0, 0) |
1200 | @defun bot:cycle channel |
1201 | Makes the bot leave and join @var{channel}. |
1202 | @end defun |
1203 | |
1204 | @c (2, 0, 0) |
1205 | @defun bot:deban channel mask-or-nick |
1206 | Debans @var{mask} or @var{nick} from @var{channel}. You need to be a trusted |
1207 | user to deban with a @var{mask}. |
1208 | @end defun |
1209 | |
1210 | @c (1, 0, 0) |
1211 | @defun bot:delserver server-number |
1212 | Deletes server from server list whose number in the server list |
1213 | is @var{server-number} |
1214 | @end defun |
1215 | |
1216 | @c (2, 0, 0) |
1217 | @defun bot:deluser nick-or-mask channel-mask |
1218 | Removes @var{nick} or @var{mask} from the userlist. |
1219 | @end defun |
1220 | |
1221 | @c (2, 0, 0) |
1222 | @defun bot:delshit nick-or-mask channel-mask |
1223 | Removes @var{nick} or @var{mask} from the shitlist. |
1224 | @end defun |
1225 | |
1226 | @c (2, 0, 0) |
1227 | @defun bot:deop channel mask-or-nick |
1228 | Deops @var{mask} or @var{nick} on @var{channel}. |
1229 | @end defun |
1230 | |
1231 | @c (1, 0, 0) |
1232 | @defun bot:die reason |
1233 | Makes the bot stop immediately. |
1234 | @end defun |
1235 | |
1236 | @c (1, 0, 0) |
1237 | @defun bot:do ? |
1238 | @end defun |
1239 | |
1240 | @c (2, 0, 0) |
1241 | @defun bot:invite channel nick |
1242 | Invites @var{nick} on @var{channel}. |
1243 | @end defun |
1244 | |
1245 | @c (1, 1, 0) |
1246 | @defun bot:join channel |
1247 | Makes the bot join @var{channel}. |
1248 | @end defun |
1249 | |
1250 | @c (2, 0, 0) |
1251 | @defun bot:keep channel modes |
1252 | Sets the @var{modes} that the bot will keep for @var{channel}. |
1253 | See also STATS. |
1254 | @end defun |
1255 | |
1256 | @c (2, 1, 0) |
1257 | @defun bot:kick channel mask-or-nick [reason] |
1258 | Kicks @var{mask} or @var{nick} out of @var{channel}, because of @var{reason}. |
1259 | You need to be a trusted user to use a @var{mask}. |
1260 | @end defun |
1261 | |
1262 | @c (2, 1, 0) |
1263 | @defun bot:kickban channel mask-or-nick [reason] |
1264 | Bans then kicks @var{mask} or @var{nick} out of @var{channel}, |
1265 | because of @var{reason}. |
1266 | You need to be a trusted user to use a @var{mask}. |
1267 | @end defun |
1268 | |
1269 | @c (1, 0, 0) |
1270 | @defun bot:lock channel |
1271 | Locks topic on @var{channel}. |
1272 | @end defun |
1273 | |
1274 | @c (0, 0, 0) |
1275 | @defun bot:logport |
1276 | [ Probably returns the log port? ] |
1277 | @end defun |
1278 | |
1279 | @c (2, 0, 0) |
1280 | @defun bot:mode channel mode-string |
1281 | Sends @var{mode-string} as mode for @var{channel}. |
1282 | @end defun |
1283 | |
1284 | @c (0, 0, 0) |
1285 | @defun bot:nextserver |
1286 | Makes the bot connect to the next server in its server list. |
1287 | @end defun |
1288 | |
1289 | @c (1, 0, 0) |
1290 | @defun bot:nick nick |
1291 | Makes the bot use nickname @var{nick}. |
1292 | @end defun |
1293 | |
1294 | @c (2, 0, 0) |
1295 | @defun bot:op channel nick |
1296 | Ops @var{nick} on @var{channel}. |
1297 | @end defun |
1298 | |
1299 | @c (1, 0, 0) |
1300 | @defun bot:part channel |
1301 | Makes the bot leave @var{channel}. |
1302 | @end defun |
1303 | |
1304 | @c (0, 0, 0) |
1305 | @defun bot:reconnect |
1306 | Makes the bot reconnect to its current server. |
1307 | @end defun |
1308 | |
1309 | @c (1, 0, 0) |
1310 | @defun bot:server server-number |
1311 | Select the server to connect to. @var{server-number} is the number of |
1312 | the server in the serverlist. |
1313 | @end defun |
1314 | |
1315 | @c (1, 0, 0) |
1316 | @defun bot:setfloodrate ? |
1317 | @end defun |
1318 | |
1319 | @c (1, 0, 0) |
1320 | @defun bot:setversion ? |
1321 | @end defun |
1322 | |
1323 | @c (3, 0, 0) |
1324 | @defun bot:tban channel nick-or-mask time |
1325 | Bans @var{nick} or @var{mask} from @var{channel} for @var{time} seconds. |
1326 | @end defun |
1327 | |
1328 | @c (3, 1, 0) |
1329 | @defun bot:tkban channel nick-or-mask time [reason] |
1330 | Bans @var{nick} or @var{mask} from @var{channel} for @var{time} seconds, |
1331 | then kicks him/them because of @var{reason}. |
1332 | @end defun |
1333 | |
1334 | @c (2, 0, 0) |
1335 | @defun bot:topic channel topic |
1336 | If no @var{topic} is given, prints @var{channel}'s topic. Otherwise, |
1337 | the bot will change @var{channel}'s topic to @var{topic}. |
1338 | @end defun |
1339 | |
1340 | @defun bot:unlock channel |
1341 | Makes the bot unlock topic on @var{channel}. |
1342 | @end defun |
1343 | |
c6e7af05 |
1344 | @defun bot:who target |
1345 | Sends a WHO command to @var{target}. @var{target} may be either a |
1346 | channel or a user. |
1347 | @end defun |
1348 | |
1349 | @defun bot:whois nick |
1350 | Sends a WHOIS command to @var{nick}. @var{nick} @strong{must} be a |
1351 | nickname, you cannot send a WHOIS to a channel. |
1352 | @end defun |
1353 | |
9efc3706 |
1354 | @c (0, 0, 0) |
1355 | @defun bot:getnickname |
1356 | [ Gets the bot's nickname? ] |
1357 | @end defun |
1358 | |
1359 | @c (0, 0, 0) |
1360 | @defun bot:getserver |
1361 | @end defun |
1362 | |
1363 | @c (0, 0, 0) |
1364 | @defun bot:getserverlist |
1365 | @end defun |
1366 | |
1367 | @c (0, 0, 0) |
1368 | @defun bot:flush |
1369 | [ Flushes the socket to the server? ] |
1370 | @end defun |
1371 | |
1372 | @c (0, 0, 0) |
1373 | @defun bot:flushport |
1374 | [ Flushes the log port? ] |
1375 | @end defun |
1376 | |
1377 | @c (1, 0, 0) |
1378 | @defun bot:random ? |
1379 | [ Returns a random number? What range? Why? ] |
1380 | @end defun |
1381 | |
1382 | @c (1, 0, 0) |
1383 | @defun bot:delcommand |
1384 | [ Probably deletes a command added with @code{bot:addcommand} ? ] |
1385 | @end defun |
1386 | |
1387 | @c (2, 0, 0) |
1388 | @defun bot:addtimer ? ? |
1389 | @end defun |
1390 | |
1391 | @c (1, 0, 0) |
1392 | @defun bot:deltimer ? |
1393 | @end defun |
1394 | |
1395 | @c (2, 0, 0) |
1396 | @defun bot:dcc-chat-send ? ? |
1397 | @end defun |
1398 | |
1399 | @quotation |
1400 | [ And what about the stuff defined in @file{bobot-utils.scm} ? I just |
1401 | added it here so it could be somewhere. There should also be a |
1402 | section dealing with modules. How to use them. What module scripts |
1403 | are in. What module bobot++ provided primites are in. And so on. ] |
1404 | @end quotation |
1405 | |
1406 | @defun bot:log . messages |
1407 | Write as many @var{messages} as you want to the log. If the arg is a |
1408 | thunk it will be executed and it's output will be written to the log. |
1409 | @end defun |
1410 | |
1411 | @defun bot:load file |
1412 | @end defun |
1413 | |
1414 | @defun bot:load-module module-spec |
1415 | @end defun |
1416 | |
1417 | @defun bot:use-module module-spec |
1418 | @end defun |
1419 | |
1420 | @defun bot:match-not-channel regex |
1421 | match-not-channel adds a prefix regex to your @var{regex} so it |
1422 | doesn't match the sender or channel in a PUBLIC message |
1423 | @end defun |
1424 | |
1425 | @defun bot:match-to-me regex |
1426 | match-to-me matches text that was addressed to the bot with a |
1427 | ':', ',', or nothing after the bot name. |
1428 | @end defun |
1429 | |
1430 | @defun bot:sent-to-me? message |
1431 | @end defun |
1432 | |
1433 | @defun bot:ctcp-quote message |
1434 | Returns the CTCP quoted message |
1435 | Input @emph{MUST NOT} contain the trailing @code{\r\n} |
1436 | (it is added by the message sending code). |
1437 | @end defun |
1438 | |
1439 | |
1440 | @defvar %bot:loadpath |
1441 | @end defvar |
1442 | |
1443 | @defun %bot:load-extensions |
1444 | @end defun |
1445 | |
1446 | |
1447 | |
31433d27 |
1448 | @node Concept Index, Function Index, Scripting, Top |
1449 | @unnumbered Concept Index |
1450 | @printindex cp |
1451 | |
1452 | @node Function Index, Variable Index, Concept Index, Top |
1453 | @unnumbered Function Index |
1454 | @printindex fn |
1455 | |
1456 | @node Variable Index, , Function Index, Top |
1457 | @unnumbered Variable Index |
1458 | @printindex vr |
91dddabd |
1459 | |
1460 | @bye |