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