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