[project @ 2005-09-12 21:46:06 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
2b0ae8fd 579command. If, however, you are using the command in a channel you may
580omit the channel argument, and the bot will use the current channel.
6b59e728 581
3fed2165 582@menu
d15caa3b 583* Bot Control Commands::
3fed2165 584* Message Commands::
d15caa3b 585* Channel Control::
586* Spylist Commands::
3fed2165 587* User List Commands::
d15caa3b 588* Server List Commands::
589* Shit List Commands::
590* Channel Info::
591* Scripting Commands::
592* Authentication Commands::
593* Miscellaneous Commands::
3fed2165 594@end menu
595
d15caa3b 596@node Bot Control Commands, Message Commands, Built-In Commands, Built-In Commands
597@subsection Bot Control Commands
d15caa3b 598
2b0ae8fd 599These commands are used to control the behaviour of the bot.
5205c0b0 600
2b0ae8fd 601@deffn Command cycle channel
602Makes the bot leave and join @var{channel}.
603@end deffn
d15caa3b 604
2b0ae8fd 605@deffn Command die
606Makes the bot stop immediately.
607@end deffn
d15caa3b 608
2b0ae8fd 609@deffn Command join channel
610Makes the bot join @var{channel}.
611@end deffn
d15caa3b 612
2b0ae8fd 613@deffn Command nick newnick
614Makes the bot use nickname @var{new-nick}.
615@end deffn
d15caa3b 616
2b0ae8fd 617@deffn Command setfloodrate messages-per-second
618Sets the flood rate to @var{messages-per-second}. The bot will
619consider users sending more than @var{messages-per-second} messges in
620a second to be flooding and will ignore them.
621@end deffn
d15caa3b 622
2b0ae8fd 623@deffn Command setversion version-info
624Sets the string returned when someone requestions the version info of
625the bot.
626@end deffn
d15caa3b 627
d15caa3b 628
629@node Message Commands, Channel Control, Bot Control Commands, Built-In Commands
3fed2165 630@subsection Message Commands
631
2b0ae8fd 632These commands cause the bot to send messages (e.g. sending a message
633to a channel or performing an action). For all commands @var{target}
634may be either a user or a channel.
6b59e728 635
2b0ae8fd 636@deffn Command action target do
637Makes the bot to perform the action @var{do} in a message sent to
638@var{target}.
639@end deffn
3fed2165 640
2b0ae8fd 641@deffn Command do command
642Sends a raw irc command. @var{command} is the IRC command you wish to
643send (e.g. @samp{PRIVMSG #foo Hello!}).
644@end deffn
3fed2165 645
2b0ae8fd 646@deffn Command msg target message
647@deffnx Command say target message
648Makes the bot say @var{message} to @var{target}.
649@end deffn
3fed2165 650
d15caa3b 651@node Channel Control, Spylist Commands, Message Commands, Built-In Commands
652@subsection Channel Control
3fed2165 653
2b0ae8fd 654@deffn Command ban channel mask
655Bans @var{mask} from @var{channel}. You must be a trusted user to ban
656using a host mask, but a normal user may ban individual nicks.
657@end deffn
6b59e728 658
2b0ae8fd 659@deffn Command deban channel mask
660Debans @var{mask} from @var{channel}. You must be a trusted user to
661deban with a @var{mask}.
662@end deffn
6b59e728 663
2b0ae8fd 664@deffn Command deop channel mask
665Deops @var{mask} on @var{channel}.
666@end deffn
6b59e728 667
2b0ae8fd 668@deffn Command invite nick channel
669Invites @var{nick} to @var{channel}.
670@end deffn
6b59e728 671
2b0ae8fd 672@deffn Command keep channel modes
673Sets the @var{modes} that the bot will keep for @var{channel}.
674@end deffn
675
676@deffn Command kick channel mask reason
677@deffnx Command kickban channel mask reason
678Kicks @var{mask} out of @var{channel}, because of
679@var{reason}. @command{kickban} also bans @var{mask}.You must be a
680trusted user to use a mask.
681@end deffn
682
683@deffn Command lock channel
684Locks topic on @var{channel}
685@end deffn
686
687@deffn Command mode channel modes
688Sets mode of @var{channel} to the mode string @var{modes}.
689@end deffn
690
691@deffn Command op channel nick
692Ops @var{nick} on @var{channel}
693@end deffn
694
695@deffn Command part channel
696Makes the bot leave @var{channel}.
697@end deffn
698
699@deffn Command tban channel mask time
700@deffnx Command tkban channel mask time
701Bans @var{mask} from @var{channel} for @var{time}
702seconds. @command{tkban} also kicks the user. You must be a trusted
703user to use a mask.
704@end deffn
705
706@deffn Command topic channel [topic]
707Sets the topic in @var{channel} to @var{topic}. If @var{topic} is not
708supplied the current topic is sent as a notice to the user calling the
709command.
710@end deffn
6b59e728 711
2b0ae8fd 712@deffn Command unlock channel
713Unlocks the topic on @var{channel}
714@end deffn
6b59e728 715
d15caa3b 716@node Spylist Commands, User List Commands, Channel Control, Built-In Commands
717@subsection Spylist Commands
6b59e728 718
5205c0b0 719@itemize
6b59e728 720
5205c0b0 721@item @command{spylist} Shows the bot's spylist.
d15caa3b 722
5205c0b0 723@item @command{spymessage} Adds you to the spylist
6b59e728 724
5205c0b0 725@item @command{rspymessage} Removes you from the spy
9efc3706 726list.
6b59e728 727
5205c0b0 728@end itemize
d15caa3b 729
730
731@node User List Commands, Server List Commands, Spylist Commands, Built-In Commands
732@subsection User List Commands
733
2b0ae8fd 734@deffn Command adduser mask
735Adds the user
736@end deffn
3fed2165 737
2b0ae8fd 738@command{deluser} Removes @var{nick} or
d15caa3b 739@var{mask} from the userlist.
740
2b0ae8fd 741@deffn Command save
742Saves the userlist.
743@end deffn
d15caa3b 744
2b0ae8fd 745@command{userlist} Shows the bot's userlist
d15caa3b 746
747@node Server List Commands, Shit List Commands, User List Commands, Built-In Commands
748@subsection Server List Commands
d15caa3b 749
5205c0b0 750@itemize
751
752@item @command{addserver} Adds the server specified by
d15caa3b 753@var{host name} or @var{ip address} to the server list.
754
5205c0b0 755@item @command{delserver} Deletes server from server
d15caa3b 756list whose number in the server list is @var{server number}.
757
5205c0b0 758@item @command{nextserver} Makes the bot connect to the
d15caa3b 759next server in its server list.
760
5205c0b0 761@item @command{reconnect} Makes the bot reconnect to
d15caa3b 762its current server.
6b59e728 763
5205c0b0 764@item @command{server} Select the server to connect
9efc3706 765to. @var{server number} is the number of the server in the serverlist.
6b59e728 766
5205c0b0 767@item @command{serverlist} Shows the bot's serverlist.
6b59e728 768
5205c0b0 769@end itemize
6b59e728 770
d15caa3b 771@node Shit List Commands, Channel Info, Server List Commands, Built-In Commands
772@subsection Shit List Commands
d15caa3b 773
5205c0b0 774@itemize
d15caa3b 775
5205c0b0 776@item @command{addshit}
777
778@item @command{delshit} Removes @var{nick} or
d15caa3b 779@var{mask} from the shitlist
6b59e728 780
5205c0b0 781@item @command{shitlist} Shows the bot's shitlist.
6b59e728 782
5205c0b0 783@end itemize
6b59e728 784
d15caa3b 785@node Channel Info, Scripting Commands, Shit List Commands, Built-In Commands
786@subsection Channel Info
787
5205c0b0 788@itemize
d15caa3b 789
5205c0b0 790@item @command{banlist}
d15caa3b 791
5205c0b0 792@item @command{channels} Prints the channel(s) where
d15caa3b 793the bot is currently.
794
5205c0b0 795@item @command{names} Yes Shows the nicknames and
d15caa3b 796status of users on @var{channel}.
6b59e728 797
5205c0b0 798@item @command{stats} Yes Gives @var{channel}'s statistics.
799@end itemize
6b59e728 800
d15caa3b 801@node Scripting Commands, Authentication Commands, Channel Info, Built-In Commands
802@subsection Scripting Commands
6b59e728 803
5205c0b0 804@itemize
6b59e728 805
5205c0b0 806@item @command{execute} @strong{Only available if scripting support is enabled}
6b59e728 807
5205c0b0 808@item @command{load} Reloads the userlist from disk.
d15caa3b 809
5205c0b0 810@item @command{loadscript} @strong{Only available if scripting support is enabled}
811
812@end itemize
d15caa3b 813
814@node Authentication Commands, Miscellaneous Commands, Scripting Commands, Built-In Commands
815@subsection Authentication Commands
d15caa3b 816
5205c0b0 817@itemize
818
819@item @command{ident} Identifies you on the bot. Note
d15caa3b 820that you should not use this command in public @dots{}
821
5205c0b0 822@item @command{password} Changes your password on the
d15caa3b 823bot. Use @code{NONE} as password if you want to clear it. Do not use this
824command in public!
825
5205c0b0 826@end itemize
d15caa3b 827
828@node Miscellaneous Commands, , Authentication Commands, Built-In Commands
829@subsection Miscellaneous Commands
d15caa3b 830
5205c0b0 831@itemize
832
833@item @command{alias} Makes an alias, and adds the
d15caa3b 834function @var{new name}, that will do exactly the same command as
835@var{old name}.
836
5205c0b0 837@item @command{dcclist} Gives the list of all DCC Chat
d15caa3b 838connections.
839
5205c0b0 840@item @command{help}
d15caa3b 841
5205c0b0 842@item @command{nslookup} Does a nameserver query about
d15caa3b 843@var{nick} host, @var{host} or @var{ip address}.
6b59e728 844
6b59e728 845
5205c0b0 846@item @command{who} Yes Show your level on @var{channel}
6b59e728 847
5205c0b0 848@item @command{whois} Yes Shows information about
9efc3706 849@var{nick} on @var{channel}
6b59e728 850
5205c0b0 851@end itemize
6b59e728 852
e07b6b46 853@node Scripting, Concept Index, Using the Bot, Top
31433d27 854@chapter Scripting
855
856Bobot++'s most powerful feature is its scripting system. You write
857scripts using Guile Scheme. This manual does not cover how to use
ad529fde 858Guile or how to learn Scheme. @xref{Top, , Guile Reference Manual,
859guile, The Guile Reference Manual}, for the Guile reference manual and
31433d27 860@url{http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html} for
861a good tutorial on Scheme.
862
439869bf 863Note that in previous versions the scripting commands where in the
864form @code{bot-@var{function}}. They are now in the form
865@code{bot:@var{function}}. The old names are still available, but are
c8f13c06 866deprecated and will be removed in Bobot++ 3.0. New commands are only
867available with the @code{bot:} prefix. The command @command{perl -pi
868-e ``s/bot-/bot:/g'' @var{your-files}} should be enough to convert
869your code to use the new functions.
439869bf 870
ae97d6ec 871@strong{NOTE}: All arguments to functions and hooks called by the bot
872are strings unless otherwise specified.
873
439869bf 874@menu
875* Adding New Commands::
876* Hooks::
e07b6b46 877* Sending Messages::
91dddabd 878* Misc Scripting Stuff::
3fed2165 879* Scheme Commands::
880* Query Functions::
439869bf 881@end menu
882
883@node Adding New Commands, Hooks, Scripting, Scripting
884@section Adding New Commands
885
02341ea9 886Adding a new command is simple. To register a new command use
887@code{bot:addcommand}.
9efc3706 888
889@defun bot:addcommand name func needs-channel? num-of-args min-level
890
891The @var{name} is a string representing the name of the command being
892added. @var{func} is a function accepting @var{num-of-args}
893arguments. @var{needs-channel?} is a bool that is true if the function
894needs the channel name as its first arg, and false otherwise.
895@var{num-of-args} is the number of args @var{func} will take and must
896be within zero (0) and twenty (20). @var{min-level} is one of the
528799bd 897@ref{User Levels}. A user must be at least a @var{min-level} user to
898use the new command. None of the arguments are guaranteed to be
899passed; if they aren't they are set to the empty string @code{""}. An
900example of a new command would be:
fed59248 901
902@example
e07b6b46 903(define (hello channel name)
fed59248 904 (if (string=? name "")
e07b6b46 905 (bot:say channel "Hello world!")
906 (bot:say channel (string-append "Hello " name "!")))
907
908(bot:addcommand "hello" hello #t 2 0)
fed59248 909@end example
910
e07b6b46 911This will display ``Hello World!'' if called as @kbd{!hello} and
ae97d6ec 912``Hello World @var{USER}'' if called as @kbd{!hello @var{USER}}.
9efc3706 913@end defun
e07b6b46 914
528799bd 915@node Hooks, Sending Messages, Adding New Commands, Scripting
439869bf 916@section Hooks
917
e07b6b46 918@cindex Background on Hooks
439869bf 919Hooks are a powerful feature of Bobot++. Hooks are a hybrid of ircII
fed59248 920and tiny fugue (a MUD bot) hooks with a little bit of extra stuff
02341ea9 921added in. A hook is called when a regular expression is matched
922against a message sent to or by the bot.
923
924Bobot++ uses different hook types for each IRC message type, and also
925includes a hook for accessing raw irc messages. Hooks are tagged with
926a priority and a flag that specifies whether to call the next hook
927that matches after calling the current one or to stop
928processing.
929
930Hooks are processed from the highest to lowest priority, with
931fallthrough hooks of equal priority to non-fallthrough hooks being
932executed first.
439869bf 933
934@menu
935* Creating a Hook::
936* Hook Types::
937@end menu
938
939@node Creating a Hook, Hook Types, Hooks, Hooks
940@subsection Creating a Hook
941
9efc3706 942To add a new hook you use the function @code{bot:addhook}.
943
944@defun bot:addhook type regex function [pri fall name]
945@var{type} specifies the type of hook (the types of hooks are listed
ae97d6ec 946in @ref{Hook Types}).
947
948@var{regex} is a standard regular expression. If
949@var{regex} is matched, @var{function} will be called.
950
951@var{function} will take a different number of args depending on the
952hook type.
953
954@var{pri} specifies the priority of the hook---higher priority hooks
955are executed first. This argument is optional and defaults to
956@code{0}.
957
958@var{fall} is @code{#t} if the hook is a fallthrough hook and
959@code{#f} is the hook is not a fallthrough hook. This arg is also
960optional and defaults to @code{#t}.
961
962@var{name} is the optional name of the hook that defaults to
963@code{"DEFAULT"}. If you set the name then you can have more than
964one hook that matches the same regexp, as long as they have the same
965name. E.g. in a log script you could have the regexps for the log
966function all be @code{".*"} and set their names to @code{"log"} to
967avoid a conflict with other hooks.
9efc3706 968@end defun
439869bf 969
970@node Hook Types, , Creating a Hook, Hooks
971@subsection Hook Types
972
ae97d6ec 973The following sections document the different hooks Bobot++ exposes.
974
975The general format of each hook description is as if it were a
c99c411a 976function to be defined, but these describe the function to be passed
9efc3706 977to @code{bot:add-hook}. Do @emph{not} name your functions these
978names.
439869bf 979
9efc3706 980That said, here is the list of available hooks functions.
981FIXME: write docs
982
ae97d6ec 983@menu
984* Received Message Hooks::
985* Sent Message Hooks::
986* DCC CHAT Hooks::
987* Miscellaneous Hooks::
988@end menu
989
990@node Received Message Hooks, Sent Message Hooks, Hook Types, Hook Types
991@subsubsection Receieved Message Hooks
992
993The following hooks are triggered when a mesage is received by the bot.
994
9efc3706 995@defun hooks/action from to action
ae97d6ec 996This hook is triggered when someone performs an action.
997
998@var{from} is the nickname the person that performed the
999action.
1000
9efc3706 1001@var{to} is the target of the action, which is either a channel or the
ae97d6ec 1002Bot's nick if the user private messages the bot.
439869bf 1003
ae97d6ec 1004@var{action} is the text of the action. E.g. if someone did @samp{*
1005foobar does baz}, then @var{action} would be the string @code{"does
1006baz"}.
1007@end defun
439869bf 1008
9efc3706 1009@defun hooks/nickname old-nick new-nick
ae97d6ec 1010This hook is called when someone changes his nickname from
9efc3706 1011@var{old-nick} to @var{new-nick}.
1012@end defun
439869bf 1013
ae97d6ec 1014@defun hooks/signoff nick message
1015This hook is called when someone signs off of IRC.
1016
1017@var{nick} is the nickname of the person signing off.
1018
1019@var{message} is his quit message
9efc3706 1020@end defun
439869bf 1021
9efc3706 1022@defun hooks/ctcp nick to command rest
ae97d6ec 1023This hook is called when a CTCP request is received by the bot.
1024
1025@var{nick} is the nickname of the sender.
1026
1027@var{to} is the target of the CTCP request. This will either be a
1028channel the bot is in, or the nickname of the bot.
1029
1030@var{command} is the CTCP command issued.
1031
1032@var{rest} contains the arguments to the CTCP command.
9efc3706 1033@end defun
439869bf 1034
9efc3706 1035@defun hooks/ctcp-reply nick command rest
ae97d6ec 1036This hook is called when a CTCP REPLY is received. This occurs when
1037the bot has sent a CTCP request to another client. The CTCP REPLY is
1038always addressed to the bot directly.
1039
1040@var{nick} is the nickname of the person who replied.
1041
1042@var{command} is the command to which @var{nick} is replying.
439869bf 1043
ae97d6ec 1044@var{rest} contains the body of the reply.
9efc3706 1045@end defun
439869bf 1046
ae97d6ec 1047@defun hooks/disconnect server intentional
1048This is called when the bot is disconnected from a server.
1049
1050@var{server} is the hostname of the server from which the bot was
1051disconnected.
1052
1053@var{intentional} is a flag set to @code{#t} when the bot disonnected
1054from the server as the result of a command (issued by a user from IRC,
1055SIGHUP, or from a script), or @code{#f} when the bot disconnected from
1056the server unintentionally..
9efc3706 1057@end defun
439869bf 1058
9efc3706 1059@defun hooks/invite nick channel
ae97d6ec 1060This hook is called when a user invited the bot to join a channel.
1061
1062@var{nick} is the nickname of the user who sent the invite.
1063
1064@var{channel} is the channel to which the bot was invited.
9efc3706 1065@end defun
439869bf 1066
9efc3706 1067@defun hooks/join nick channel
ae97d6ec 1068This is called when a user or the bot joins a channel.
1069
1070@var{nick} is the nickname of the user who joined @var{channel}. This
1071may be the bot's nickname (the IRC server sends the JOIN command back
1072to the the bot after it joins a channel).
1073
1074@var{channel} is the channel that was joined
9efc3706 1075@end defun
439869bf 1076
9efc3706 1077@defun hooks/kick target from channel reason
ae97d6ec 1078This hook is called when a user, including the bot, is kicked out of a
1079channel.
1080
1081@var{target} is the nick of the user who was kicked. This may be the
1082bot's nick.
1083
1084@var{from} is the nick of the user who issued the kick. This may also
1085be the bot's nick.
1086
1087@var{channel} is the channel the kick was issued in.
1088
1089@var{reason} is the reason the user was kicked.
9efc3706 1090@end defun
439869bf 1091
ae97d6ec 1092@defun hooks/part nick channel
1093This hook is called when a user parts a channel.
1094
1095@var{nick} is the user who parted the channel. This may be the bot.
1096
1097@var{channel} is the channel from which the user parted.
9efc3706 1098@end defun
439869bf 1099
ae97d6ec 1100@defun hooks/mode nick target modes
1101This hook is called when someone sets the modes of @var{target}.
1102
1103@var{nick} is the user who set the modes. This may be the bot.
1104
1105@var{target} is the target of the MODE command. This may be a
1106channel or a user. If it is a user, it may be the bot.
1107
1108@var{modes} is the MODE string.
9efc3706 1109@end defun
439869bf 1110
ae97d6ec 1111@defun hooks/message nick message
1112This hook is called when someone sends a private message to the bot.
1113
1114@var{nick} is the nickname of the user who sent the message.
1115
1116@var{message} is the message the user sent.
9efc3706 1117@end defun
439869bf 1118
9efc3706 1119@defun hooks/notice nick message
ae97d6ec 1120This hook is called when a user send a private notice to the bot.
1121
1122@var{nick} is the user who sent the notice.
1123
1124@var{message} is the message the user sent.
9efc3706 1125@end defun
439869bf 1126
ae97d6ec 1127@defun hooks/public nick channel message
1128This hook is called when a user sends a normal message to a channel.
1129
1130@var{nick} is the user who sent the message.
1131
1132@var{channel} is the channel to which the message was sent.
1133
1134@var{message} is the message that was sent.
9efc3706 1135@end defun
439869bf 1136
ae97d6ec 1137@defun hooks/public-notice nick channel message
1138This hook is called when a user send a notice to a channel.
1139
1140@var{nick} is the user who sent the notice.
1141
1142@var{channel} is the channel to which the notice was sent.
1143
1144@var{message} is the message that was sent.
9efc3706 1145@end defun
439869bf 1146
9efc3706 1147@defun hooks/raw raw-message
ae97d6ec 1148This hook is called every time a message is received. This matches on
1149the raw message text and passes the hook function the raw IRC message.
439869bf 1150
ae97d6ec 1151@var{raw-message} is the raw IRC message.
9efc3706 1152@end defun
439869bf 1153
9efc3706 1154@defun hooks/topic nick channel new-topic
ae97d6ec 1155This hook is called when a user changes the topic in a channel.
1156
1157@var{nick} is the user who set the topic. This may be the bot.
1158
1159@var{channel} is the channel that's topic was changed.
1160
1161@var{new-topic} is the new topic.
9efc3706 1162@end defun
0b7a49e2 1163
ae97d6ec 1164@node Sent Message Hooks, DCC CHAT Hooks, Received Message Hooks, Hook Types
1165@subsubsection Sent Message Hooks
1166
1167These hooks are called when the bot sends a message. @var{mynick} is
1168always the bot's nick and will not be documented in each hook
1169description.
1170
1171@defun hooks/send/public mynick channel message
1172This hook is called when the bot sends a normal message to a channel.
1173
1174@var{channel} is the channel to which the bot sent the message.
1175
1176@var{message} is the message the bot sent.
9efc3706 1177@end defun
1178
ae97d6ec 1179@defun hooks/send/message mynick to message
1180This hook is called when the bot sends a private message to a user.
1181
1182@var{to} is the nick of the user to whom the message was sent.
1183
1184@var{message} is the message that was sent.
9efc3706 1185@end defun
439869bf 1186
9efc3706 1187@defun hooks/send/action mynick to message
ae97d6ec 1188This hook is called when the bot sents an action to a channel or a
1189user.
1190
1191@var{to} is the channel or nick of the user to which the action was
1192sent.
1193
1194@var{message} is the text of the action.
9efc3706 1195@end defun
1196
1197@defun hooks/send/ctcp mynick to command message
ae97d6ec 1198This hook is called when the bot sends a CTCP message @emph{other
1199than} an ACTION to a channel or user.
1200
1201@var{to} is the channel or nick of the user to which the CTCP was
1202sent.
1203
1204@var{command} is the CTCP command that was sent.
1205
1206@var{message} is a string containing the arguments to the CTCP command.
9efc3706 1207@end defun
1208
528799bd 1209@defun hooks/send/who who
1210This is called when the bot sends a WHO message. The regex is matched
1211on @var{who}, which is also passed as the only argument to your
1212function.
1213
1214@var{who} is the channel or nick that was WHOed.
1215@end defun
1216
1217@defun hooks/send/whois nick
1218This is called when the bot sends a WHOIS message. The regex is
1219matched on @var{nick}, which is also passed as the only argument to
1220your function.
1221
1222@var{nick} is the nickname of the person who was WHOISed.
1223@end defun
1224
ae97d6ec 1225@node DCC CHAT Hooks, Miscellaneous Hooks, Sent Message Hooks, Hook Types
1226@subsubsection DCC CHAT Hooks
1227
1228These hooks are called when a user initializes a DCC CHAT and when the
1229bot receives messages from the user in a DCC CHAT.
1230
9efc3706 1231@defun hooks/dcc/chat-begin from
ae97d6ec 1232This hook is called when a user begins a DCC CHAT with the bot.
9efc3706 1233@var{from} is the user's address in the form @samp{nick!user@@host}.
1234@end defun
1235
133eff7a 1236@defun hooks/dcc/chat-end address
1237This hook is called when a DCC CHAT is purged after being idle for a
1238while, or when the user closes the DCC CHAT. As such, you cannot write
1239any more data to the DCC CHAT.
1240
1241@var{address} is the address (nick!user@@host) of the person on the
1242other side of the DCC.
1243@end defun
1244
9efc3706 1245@defun hooks/dcc/chat-message from message
ae97d6ec 1246This hook is called when a user sends a message to the bot through
1247a DCC CHAT.
1248
1249@var{from} is the user's address in the form @samp{nick!user@@host}.
1250
1251@var{message} is the message the user sent to the bot.
1252@end defun
1253
1254@node Miscellaneous Hooks, , DCC CHAT Hooks, Hook Types
1255@subsubsection Miscellaneous Hooks
1256
1257@defun hooks/flood nick
1258This hook is called when a user is detected flooding the bot.
1259
1260@var{nick} is the nickname of the user flooding the bot.
1261@end defun
1262
1263@defun hooks/timer time
1264This hook is called once a minute. The regex is @strong{not} used.
1265
1266@var{time} is the in zero-padded @code{hh:mm} format.
9efc3706 1267@end defun
439869bf 1268
528799bd 1269
1270@node Sending Messages, Misc Scripting Stuff, Hooks, Scripting
e07b6b46 1271@section Sending Messages
1272
1273There are several types of messages you can send with Bobot++ from
528799bd 1274scripts. They are split into High and Low level message sending
1275functions. Most bots will only use the high level functions, but the
1276low level ones are provided for when a bot needs to do things like
1277send raw IRC messages or CTCP commands.
e07b6b46 1278
1279@menu
1280* High Level Message Functions::
1281* Low Level Message Functions::
1282@end menu
1283
1284@node High Level Message Functions, Low Level Message Functions, Sending Messages, Sending Messages
1285@subsection ``High Level'' Message Functions
1286
9efc3706 1287@defun bot:action channel message
1288Send an ``action'' type @var{message} to @var{channel}
1289@end defun
1290
528799bd 1291
1292@defun bot:msg target message
1293@defunx bot:say target message
1294Send a public or private message to @var{target}.
1295
1296@var{target} may be a channel or a nickname.
1297
1298In versions of Bobot++ prior to 2.1.8 @code{bot:say} could only send
1299to channels, and @code{bot:msg} could only send private messages to
1300users. They are aliases of the same command now, but it may be worth
1301using them as they used to for clarity.
9efc3706 1302@end defun
e07b6b46 1303
5aec4622 1304@defun bot:notice target message
1305Sends @var{message} as a NOTICE to @var{target}. @var{target} may be a
528799bd 1306user (nick) or a channel.
5aec4622 1307@end defun
1308
e07b6b46 1309@node Low Level Message Functions, , High Level Message Functions, Sending Messages
1310@subsection ``Low Level'' Message Functions
1311
9efc3706 1312@c Add a url for rfc2812
e07b6b46 1313The ``Low Level'' messaging functions allow you to do things like send
1314CTCP messages. You probably want to read rfc 2812 and the CTCP spec
1315before using these. If you have no idea what these do, read rfc 2812
1316(IRC Client Protocol) and CTCP spec. These functions all return
9efc3706 1317@code{*unspecified*} always, so don't use the return value for
1318anything.
e07b6b46 1319
c99c411a 1320@defun bot:ctcp to command message
1085f47c 1321@var{to} is the target of your CTCP message, @var{command} is the
1322CTCP command, and @var{message} is the message (or arguments) of the
e07b6b46 1323command. Make sure to @code{bot:ctcp-quote} the message!
9efc3706 1324@end defun
e07b6b46 1325
c99c411a 1326@defun bot:ctcp-reply to command message
1085f47c 1327@var{to} is the target of your CTCP reply, @var{command} is the
1328CTCP command, and @var{message} is the message (or arguments) of the
672b7d4e 1329command. Make sure to @code{bot:ctcp-quote} the message!
1330
1331This is used to reply to a ctcp that the bot has received.
1332@end defun
1333
3fed2165 1334@node Misc Scripting Stuff, Scheme Commands, Sending Messages, Scripting
91dddabd 1335@section Misc. Scripting Stuff
1336
1337These are a few useful things that I thought people writing scripts
1338might want to know.
1339
fed59248 1340@vindex exit-hook
91dddabd 1341If you want to execute code when the bot exits, just do
1342@code{add-hook! bot:exit-hook @var{thunk}} where @var{thunk} is an
1343argumentless procedure (a thunk). When the bot exits your thunk will
1344be called.
1345
9efc3706 1346
3fed2165 1347@menu
1348* Scheme Commands::
1349* Query Functions::
1350@end menu
1351
1352@node Scheme Commands, Query Functions, Misc Scripting Stuff, Scripting
1353@section Scheme Commands
9efc3706 1354
3fed2165 1355These scheme functions are the same as the commands.
1356They allow you to execute bot commands from scheme scripts.
9efc3706 1357
1358@defun bot:adduser nick-or-mask cbannel-mask level prot auto-op
1359Adds an user to the userlist, for a @code{nick!user@@host} matching the
1360one given, on a channel matching the @var{channelMask} given.
1361
1362@multitable @columnfractions 0.33 0.33 0.33
1363@item The @var{level} can be: @tab The @var{prot} can be: @tab The @var{auto-op} can be:
1364@item 0 - No level @tab 0 - No protection @tab 0 - No auto-op
1365@item 1 - User @tab 1 - No ban @tab 1 - Op on join
1366@item 2 - Trusted User @tab 2 - No kick @tab
1367@item 3 - Friend @tab 3 - No deop @tab
1368@item 4 - Master @tab @tab
1369@end multitable
1370
1371@end defun
1372
1373@c (3, 4, 0)
1374@defun bot:addserver hostname ip-address [portnumber]
1375Adds the server specified by @var{hostname} or @var{ip-address} to
1376the server list.
1377@end defun
1378
1379@c (3, 2, 0)
1380@defun bot:addshit nick-or-mask channel-mask level [time reason]
1381Adds an user to the shitlist, for a nick!user@@host matching the
1382one given, on a channel matching the @var{channelMask} given.
1383
1384@display
1385The @var{level} can be:
1386 0 - No shit
1387 1 - No op
1388 2 - Kick and Ban on join
1389 3 - Kick and Ban on join, no deban
1390@end display
1391
1392@end defun
1393
1394@c (2, 0, 0)
1395@defun bot:ban channel mask-or-nick
2b0ae8fd 1396Bans @var{mask} or @var{nick} from @var{channel}. You must be a trusted
9efc3706 1397user to ban with a @var{mask}.
1398@end defun
1399
1400@c (2, 0, 0)
1401@defun bot:change-command-level nick-or-mask channel-mask new-level
1402Gives @var{nick} or @var{mask} level @var{new-level} on channel(s)
1403@var{channel-mask}. Note that you can not change level for someone
1404whose level is greater than yours, and that you can not give a
1405level greater than yours.
1406@end defun
1407
1408@c (1, 0, 0)
1409@defun bot:cycle channel
1410Makes the bot leave and join @var{channel}.
1411@end defun
1412
1413@c (2, 0, 0)
1414@defun bot:deban channel mask-or-nick
2b0ae8fd 1415Debans @var{mask} or @var{nick} from @var{channel}. You must be a trusted
9efc3706 1416user to deban with a @var{mask}.
1417@end defun
1418
1419@c (1, 0, 0)
1420@defun bot:delserver server-number
1421Deletes server from server list whose number in the server list
1422is @var{server-number}
1423@end defun
1424
1425@c (2, 0, 0)
1426@defun bot:deluser nick-or-mask channel-mask
1427Removes @var{nick} or @var{mask} from the userlist.
1428@end defun
1429
1430@c (2, 0, 0)
1431@defun bot:delshit nick-or-mask channel-mask
1432Removes @var{nick} or @var{mask} from the shitlist.
1433@end defun
1434
1435@c (2, 0, 0)
1436@defun bot:deop channel mask-or-nick
1437Deops @var{mask} or @var{nick} on @var{channel}.
1438@end defun
1439
1440@c (1, 0, 0)
1441@defun bot:die reason
1442Makes the bot stop immediately.
1443@end defun
1444
1445@c (1, 0, 0)
1446@defun bot:do ?
1447@end defun
1448
1449@c (2, 0, 0)
1450@defun bot:invite channel nick
1451Invites @var{nick} on @var{channel}.
1452@end defun
1453
1454@c (1, 1, 0)
1455@defun bot:join channel
1456Makes the bot join @var{channel}.
1457@end defun
1458
1459@c (2, 0, 0)
1460@defun bot:keep channel modes
1461Sets the @var{modes} that the bot will keep for @var{channel}.
1462See also STATS.
1463@end defun
1464
1465@c (2, 1, 0)
1466@defun bot:kick channel mask-or-nick [reason]
1467Kicks @var{mask} or @var{nick} out of @var{channel}, because of @var{reason}.
2b0ae8fd 1468You must be a trusted user to use a @var{mask}.
9efc3706 1469@end defun
1470
1471@c (2, 1, 0)
1472@defun bot:kickban channel mask-or-nick [reason]
1473Bans then kicks @var{mask} or @var{nick} out of @var{channel},
1474because of @var{reason}.
2b0ae8fd 1475You must be a trusted user to use a @var{mask}.
9efc3706 1476@end defun
1477
1478@c (1, 0, 0)
1479@defun bot:lock channel
1480Locks topic on @var{channel}.
1481@end defun
1482
9efc3706 1483@c (2, 0, 0)
1484@defun bot:mode channel mode-string
1485Sends @var{mode-string} as mode for @var{channel}.
1486@end defun
1487
1488@c (0, 0, 0)
1489@defun bot:nextserver
1490Makes the bot connect to the next server in its server list.
1491@end defun
1492
1493@c (1, 0, 0)
1494@defun bot:nick nick
1495Makes the bot use nickname @var{nick}.
1496@end defun
1497
1498@c (2, 0, 0)
1499@defun bot:op channel nick
1500Ops @var{nick} on @var{channel}.
1501@end defun
1502
1503@c (1, 0, 0)
1504@defun bot:part channel
1505Makes the bot leave @var{channel}.
1506@end defun
1507
1508@c (0, 0, 0)
1509@defun bot:reconnect
1510Makes the bot reconnect to its current server.
1511@end defun
1512
1513@c (1, 0, 0)
1514@defun bot:server server-number
1515Select the server to connect to. @var{server-number} is the number of
1516the server in the serverlist.
1517@end defun
1518
1519@c (1, 0, 0)
1520@defun bot:setfloodrate ?
1521@end defun
1522
1523@c (1, 0, 0)
1524@defun bot:setversion ?
1525@end defun
1526
1527@c (3, 0, 0)
1528@defun bot:tban channel nick-or-mask time
1529Bans @var{nick} or @var{mask} from @var{channel} for @var{time} seconds.
1530@end defun
1531
1532@c (3, 1, 0)
1533@defun bot:tkban channel nick-or-mask time [reason]
1534Bans @var{nick} or @var{mask} from @var{channel} for @var{time} seconds,
1535then kicks him/them because of @var{reason}.
1536@end defun
1537
1538@c (2, 0, 0)
1539@defun bot:topic channel topic
1540If no @var{topic} is given, prints @var{channel}'s topic. Otherwise,
1541the bot will change @var{channel}'s topic to @var{topic}.
1542@end defun
1543
1544@defun bot:unlock channel
1545Makes the bot unlock topic on @var{channel}.
1546@end defun
1547
c6e7af05 1548@defun bot:who target
1549Sends a WHO command to @var{target}. @var{target} may be either a
1550channel or a user.
1551@end defun
1552
1553@defun bot:whois nick
1554Sends a WHOIS command to @var{nick}. @var{nick} @strong{must} be a
1555nickname, you cannot send a WHOIS to a channel.
1556@end defun
1557
3fed2165 1558
1559
1560@c (1, 0, 0)
1561@defun bot:delcommand
1562[ Probably deletes a command added with @code{bot:addcommand} ? ]
1563@end defun
1564
1565
1566
1567@node Query Functions, , Scheme Commands, Scripting
1568@section Query Functions
1569
1570@quotation
1571[ I didn't know where to put any of these, so I just stuck them in
1572here.
1573
1574There probably needs to be several sections added, like dealing with
1575users (kicking, added, etc), dealing with the bot (channels, nickname
1576of the bot, etc), server issues (serverlist), useful tools (nslookup,
1577whois), and do on. ]
1578@end quotation
1579
1580These functions allow scripts to get various bits of information.
1581
1582@c (0, 0, 0)
1583@defun bot:logport
1584[ Probably returns the log port? ]
1585@end defun
1586
9efc3706 1587@c (0, 0, 0)
1588@defun bot:getnickname
1589[ Gets the bot's nickname? ]
1590@end defun
1591
1592@c (0, 0, 0)
1593@defun bot:getserver
1594@end defun
1595
1596@c (0, 0, 0)
1597@defun bot:getserverlist
1598@end defun
1599
1600@c (0, 0, 0)
1601@defun bot:flush
1602[ Flushes the socket to the server? ]
1603@end defun
1604
1605@c (0, 0, 0)
1606@defun bot:flushport
1607[ Flushes the log port? ]
1608@end defun
1609
1610@c (1, 0, 0)
1611@defun bot:random ?
1612[ Returns a random number? What range? Why? ]
1613@end defun
1614
9efc3706 1615@c (2, 0, 0)
1616@defun bot:addtimer ? ?
1617@end defun
1618
1619@c (1, 0, 0)
1620@defun bot:deltimer ?
1621@end defun
1622
1623@c (2, 0, 0)
1624@defun bot:dcc-chat-send ? ?
1625@end defun
1626
1627@quotation
1628[ And what about the stuff defined in @file{bobot-utils.scm} ? I just
1629added it here so it could be somewhere. There should also be a
1630section dealing with modules. How to use them. What module scripts
1631are in. What module bobot++ provided primites are in. And so on. ]
1632@end quotation
1633
1634@defun bot:log . messages
1635Write as many @var{messages} as you want to the log. If the arg is a
1636thunk it will be executed and it's output will be written to the log.
1637@end defun
1638
1639@defun bot:load file
1640@end defun
1641
1642@defun bot:load-module module-spec
1643@end defun
1644
1645@defun bot:use-module module-spec
1646@end defun
1647
1648@defun bot:match-not-channel regex
3fed2165 1649@code{bot:match-not-channel} adds a prefix regex to your @var{regex} so it
9efc3706 1650doesn't match the sender or channel in a PUBLIC message
1651@end defun
1652
1653@defun bot:match-to-me regex
3fed2165 1654@code{bot:match-to-me} matches text that was addressed to the bot with a
9efc3706 1655':', ',', or nothing after the bot name.
1656@end defun
1657
1658@defun bot:sent-to-me? message
1659@end defun
1660
1661@defun bot:ctcp-quote message
1662Returns the CTCP quoted message
1663Input @emph{MUST NOT} contain the trailing @code{\r\n}
1664(it is added by the message sending code).
1665@end defun
1666
1667
1668@defvar %bot:loadpath
1669@end defvar
1670
1671@defun %bot:load-extensions
1672@end defun
1673
1674
1675
31433d27 1676@node Concept Index, Function Index, Scripting, Top
1677@unnumbered Concept Index
1678@printindex cp
1679
1680@node Function Index, Variable Index, Concept Index, Top
1681@unnumbered Function Index
1682@printindex fn
1683
1684@node Variable Index, , Function Index, Top
1685@unnumbered Variable Index
1686@printindex vr
91dddabd 1687
1688@bye