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