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