5883a106752f7d5323dcd6602ef348d65af19295
[clinton/bobotpp.git] / bobot++.info
1 This is bobot++.info, produced by makeinfo version 4.7 from
2 bobot++.texinfo.
3
4 This file documents Bobot++ by Clinton Ebadi and Etienne Bernard
5 (original author, no longer works on program).
6
7 Copyright 2002,2004,2005 Clinton Ebadi
8
9 Permission is granted to copy, distribute and/or modify this document
10 under the terms of the GNU Free Documentation License, Version 1.1 or
11 any later version published by the Free Software Foundation; with no
12 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
13 Texts.
14
15 \1f
16 File: bobot++.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir)
17
18 This document describes Bobot++ by Clinton Ebadi and Etienne Bernard
19 (original author, no longer works on program).
20
21 This document applies to version 2.2 of the program named Bobot++
22
23 Copyright 2002,2004,2005 Clinton Ebadi
24
25 Permission is granted to copy, distribute and/or modify this document
26 under the terms of the GNU Free Documentation License, Version 1.1 or
27 any later version published by the Free Software Foundation; with no
28 Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
29 Texts.
30
31 * Menu:
32
33 * Introduction::
34 * Configuration::
35 * Using the Bot::
36 * Scripting::
37 * Concept Index::
38 * Function Index::
39 * Variable Index::
40
41 --- The Detailed Node Listing ---
42
43 Configuration
44
45 * Configuration File Placement::
46 * Configuration Files::
47
48 Configuration Files
49
50 * bot.conf::
51 * bot.users::
52
53 bot.conf
54
55 * server syntax::
56 * channel syntax::
57
58 Using Bobot++
59
60 * Starting the Bot::
61 * User Levels::
62 * Protection::
63 * Automatic Op::
64 * Built-In Commands::
65
66 Scripting
67
68 * Adding New Commands::
69 * Hooks::
70 * Scheme User Levels::
71 * Sending Messages::
72 * Misc Scripting Stuff::
73
74 Hooks
75
76 * Creating a Hook::
77 * Hook Types::
78
79 Hook Types
80
81 * Received Message Hooks::
82 * Sent Message Hooks::
83 * DCC CHAT Hooks::
84 * Miscellaneous Hooks::
85
86 Sending Messages
87
88 * High Level Message Functions::
89 * Low Level Message Functions::
90
91 \1f
92 File: bobot++.info, Node: Introduction, Next: Configuration, Prev: Top, Up: Top
93
94 1 Introduction
95 **************
96
97 This manual feels abused and neglected because it has almost no content.
98
99 \1f
100 File: bobot++.info, Node: Configuration, Next: Using the Bot, Prev: Introduction, Up: Top
101
102 2 Configuration
103 ***************
104
105 Bobot++ is easy to configure. See the `examples' directory for an
106 example configuration.
107
108 * Menu:
109
110 * Configuration File Placement::
111 * Configuration Files::
112
113 \1f
114 File: bobot++.info, Node: Configuration File Placement, Next: Configuration Files, Prev: Configuration, Up: Configuration
115
116 2.1 Configuration File Placement
117 ================================
118
119 Bobot++ will look in `/etc/bobotpp/default/' for its default config if
120 none is specified on the command line. Put the configuration files you
121 want to be loaded by default in this directory. If you are not root or
122 you want to have your own personal configuration, put it in
123 `~/.bobotpp/config/default/'.
124
125 \1f
126 File: bobot++.info, Node: Configuration Files, Prev: Configuration File Placement, Up: Configuration
127
128 2.2 Configuration Files
129 =======================
130
131 * Menu:
132
133 * bot.conf::
134 * bot.users::
135
136 \1f
137 File: bobot++.info, Node: bot.conf, Next: bot.users, Prev: Configuration Files, Up: Configuration Files
138
139 2.2.1 bot.conf
140 --------------
141
142 * Menu:
143
144 * server syntax::
145 * channel syntax::
146
147 `bot.conf' contains key value pairs separated by `='.
148
149 `<key> = <value>'
150
151 Comments are started with a `#' and cause the entire line to be
152 ignored. _Note that this only works when the `#' is the first character
153 of the line_.
154
155 bot.conf is the main configuration file for a Bobot++. The available
156 configuration variables are listed below in the format "VARIABLE
157 <default-value>: description"
158
159 * NICKNAME <Bobot>: The nickname of the bot (NICK is an alias for
160 NICKNAME)
161
162 * USERNAME <bobot>: The IRC username of the bot
163
164 * CMDCHAR <!>: The character that prefixes commands given to the bot
165 (COMMAND is an alias for CMDCHAR)
166
167 * IRCNAME <I'm a bobot++!>: The IRC name (or 'real name') of the bot
168 (REALNAME is an alias for IRCNAME)
169
170 * USERLIST <bot.users>: Name of the file where the userlist is stored
171
172 * SHITLIST <bot.shit>: Name of the file where the shitlist is stored
173
174 * LOGFILE <$LOGDIR/bot.log>: Location of the bot logfile (set this
175 to `/dev/null' to disable logging).
176
177 * SERVER <None>: This specifies the server to connect to. Note that
178 this has a special syntax.
179
180 * CHANNEL <None>: This specifies a channel the bot will join when it
181 starts up. This also has a special syntax.
182
183
184 \1f
185 File: bobot++.info, Node: server syntax, Next: channel syntax, Prev: bot.conf, Up: bot.conf
186
187 2.2.1.1 server syntax
188 .....................
189
190 SERVER = SERVER_NAME [PORT [PASSWORD]]
191
192 This will make Bobot++ attempt to connect to SERVER_NAME on port
193 PORT with the password PASSWORD. SERVER_NAME should be the address of
194 the server. PORT and PASSWORD are optional. You may use more than one
195 server line; Bobot++ will attempt to connect to the first one and, if
196 it fails, will connect to the next one in the list. There is also a
197 command to cause the bot to cycle servers. At the present time Bobot++
198 cannot connect to more than one server at a time. This is a planned
199 feature of 3.0 (which is a very long way away; the current structure of
200 the program would make it very difficult to add support for connecting
201 to multiple servers at a time in a usable manner).
202
203 \1f
204 File: bobot++.info, Node: channel syntax, Prev: server syntax, Up: bot.conf
205
206 2.2.1.2 channel syntax
207 ......................
208
209 CHANNEL = NAME:INITIAL_MODES:MODES_TO_KEEP:CHANNEL_KEY
210
211 You may have any number of channel lines. When Bobot++ starts it will
212 attempt to join and gain ops in every channel listed. It will join NAME
213 and set the channel modes to INITIAL_MODES (e.g. "nt") if it is able to
214 gain operator status. It will then maintain MODES_TO_KEEP. If the
215 channel requires a key to enter simply set CHANNEL_KEY. Every argument
216 except for NAME is optional.
217
218 A few example lines:
219
220 `CHANNEL = #foo:nt:nt:bar'
221
222 The bot will join `#foo' with the channel key `bar' and will then
223 maintain the modes `nt'.
224
225 `CHANNEL = #bar:::'
226
227 The bot will join `#bar' and will not set any modes nor will it
228 attempt to maintain any modes.
229
230 \1f
231 File: bobot++.info, Node: bot.users, Prev: bot.conf, Up: Configuration Files
232
233 2.2.2 bot.users
234 ---------------
235
236 `bot.users' is the default file name of the userlist. It may be changed
237 in `bot.conf'. The file contains lines with the format:
238
239 `MASK:CHANNEL:LEVEL:PROTECTION:AUTO-OP'
240
241 * MASK is the host mask (e.g. `*!*username
242 .domain.com') of the user
243
244 * CHANNEL is a channel mask of the channels that the user has
245 priviliges to use the bot in (e.g. `*' for all channels, `#*' for
246 all non-local channel, `#foo*' for all channels starting with
247 "foo," `#bar' for channel "#bar" only, etc.)
248
249 * LEVEL is the user level of the user (*Note User Levels::).
250
251 * PROTECTION is the protection level of the user (*Note
252 Protection::).
253
254 * AUTO-OP is set to control whether a user is automatically given
255 operator priviliges on channel entry (*Note Automatic Op::).
256
257
258 \1f
259 File: bobot++.info, Node: Using the Bot, Next: Scripting, Prev: Configuration, Up: Top
260
261 3 Using Bobot++
262 ***************
263
264 FIXME: stuff here...
265
266 * Menu:
267
268 * Starting the Bot::
269 * User Levels::
270 * Protection::
271 * Automatic Op::
272 * Built-In Commands::
273
274 \1f
275 File: bobot++.info, Node: Starting the Bot, Next: User Levels, Prev: Using the Bot, Up: Using the Bot
276
277 3.1 Starting the Bot
278 ====================
279
280 The bot is usually installed with the binary name `bobotpp'. It accepts
281 the following command line arguments:
282
283 * `[--help][-h]' - Shows detailed help and exits
284
285 * `[--version][-v]' - Shows version information and exits
286
287 * `[--no-background][-b]' - Run bobot++ in the foreground
288
289 * `[--config-file file][-f]' - Use file instead of `bot.conf'
290
291 * `[--config-dir dir][-d]' - Use dir as dir to load config file from
292
293 * `[--config dir][-c]' - Search your config path (defaults to
294 `$HOME/.bobotpp/config/' and then `/etc/bobotpp/') for dir and
295 then loads your config data using dir
296
297 * `[--sys-config dir][-s]' - Looks for config in `/etc/bobotpp/dir'.
298 Note that the user dir is still searched first
299
300 * `[--user-config dir][-u]' - Looks for config in
301 `$HOME/.bobotpp/config/dir/'. Note that the system dir is still
302 searched after this if dir is not found.
303
304 * `[--debug][-D]' Makes Bobot++ print debugging info and run in the
305 foreground
306
307 * `[--debug-scripts][-S]' Enabled the Guile debugging evaluator for
308 verbose script errors and backtraces while still running the bot
309 in the background.
310
311 The default configuration is read from
312 `$HOME/.bobotpp/config/default/' and then `/etc/bobotpp/default/' if
313 the user config is not found.
314
315 The bot defaults to running in the background as a daemon.
316
317 \1f
318 File: bobot++.info, Node: User Levels, Next: Protection, Prev: Starting the Bot, Up: Using the Bot
319
320 3.2 User Levels
321 ===============
322
323 There are several user levels available in Bobot++ to provide gradated
324 access to commands. `!adduser' and `bot.users' use the numeric code;
325 Scheme uses the textual name for the level. By default (if no catch-all
326 setting is found in *Note bot.users::.) a user has access to commands
327 with the level `bot:user-none'.
328
329 0. `bot:user-none' - No *built-in* commands may be executed _by
330 default_ (commands may be added from Scheme that can be executed
331 by users of level none and the level required to execute a command
332 may be changed from Scheme).
333
334 1. `bot:user-user' - Will be able to execute most commands but not
335 all and cannot use masks on kicks and bans.
336
337 2. `bot:user-trusted' - For built-ins with a default configuration
338 this user has access to the same set of commands as an `user' but
339 may use masks on kicks and bans. Scheme commands may be added
340 which require a user to be of this level.
341
342 3. `bot:user-friend' - In the default configuration a user who is a
343 friend will be able to do everything short of stopping the bot.
344 Again, there may be user added commands that require a higher user
345 level.
346
347 4. `bot:user-master' - This is the highest user level and has access
348 to every feature of the bot.
349
350
351 \1f
352 File: bobot++.info, Node: Protection, Next: Automatic Op, Prev: User Levels, Up: Using the Bot
353
354 3.3 Protection
355 ==============
356
357 A user added via Scheme, the `bot.users' file, or `!adduser' may be
358 protected from being deoped, kicked, or banned. There are currently no
359 symbolic levels in Scheme; just use the numeric code.
360
361 0. No protection
362
363 1. No ban. If a user is banned the bot will unban him..
364
365 2. No kick. The user may still be kicked but the bot will kickban the
366 user who kicked the protected user.
367
368 3. No deop. The bot will ensure that the user always maintains
369 operator status.
370
371 \1f
372 File: bobot++.info, Node: Automatic Op, Next: Built-In Commands, Prev: Protection, Up: Using the Bot
373
374 3.4 Automatic Op
375 ================
376
377 A user may be automatically given operator status upon entering a
378 channel. Set the AOP field to "0" to disable auto-op or "1" to enable
379 auto-op.
380
381 \1f
382 File: bobot++.info, Node: Built-In Commands, Prev: Automatic Op, Up: Using the Bot
383
384 3.5 Built-In Commands
385 =====================
386
387 Bobot++ has many built-in commands that make it useful without
388 scripting support. The reference leaves off the command char; remember
389 to use whatever you defined the command char to be in `bot.conf'. If a
390 command needs the channel name then you must specify the channel as the
391 first argument to the command when private messaging the bot a command.
392
393 COMMAND NEEDS MIN LEVEL DESCRIPTION
394 CHANNEL TO USE
395 `action' `do' Yes USER Causes the bot to perform the
396 action `do' in the current channel.
397 `adduser'
398 `addserver' Adds the server specified by HOST
399 NAME or IP ADDRESS to the server
400 list.
401 `addshit'
402 `alias' Makes an alias, and adds the
403 function NEW NAME, that will do
404 exactly the same command as OLD
405 NAME.
406 `ban' Bans MASK or NICK from CHANNEL. You
407 need to be a trusted user to ban
408 with a MASK.
409 `banlist'
410 `channels' Prints the channel(s) where the bot
411 is currently.
412 `cycle' Yes Makes the bot leave and join
413 CHANNEL.
414 `dcclist' Gives the list of all DCC Chat
415 connections.
416 `deban' Yes Debans MASK or NICK from CHANNEL.
417 You need to be a trusted user to
418 deban with a MASK.
419 `delserver' Deletes server from server list
420 whose number in the server list is
421 SERVER NUMBER.
422 `deluser' Removes NICK or MASK from the
423 userlist.
424 `delshit' Removes NICK or MASK from the
425 shitlist.
426 `deop' Yes Deops MASK or NICK on CHANNEL.
427 `die' Makes the bot stop immediately.
428 `do'
429 `execute' *Only available if scripting
430 support is enabled*
431 `help'
432 `ident' Identifies you on the bot. Note
433 that you should not use this
434 command in public ...
435 `invite' Yes Invites NICK on CHANNEL.
436 `join' Makes the bot join CHANNEL.
437 `keep' Yes Sets the MODES that the bot will
438 keep for CHANNEL.
439 `kick' Yes Kicks MASK or NICK out of CHANNEL,
440 because of REASON. You need to be a
441 trusted user to use a MASK.
442 `kickban' Yes Bans then kicks MASK or NICK out of
443 CHANNEL, because of REASON. You need
444 to be a trusted user to use a MASK.
445 `load' Reloads the userlist from disk.
446 `loadscript' *Only available if scripting
447 support is enabled*
448 `lock' Locks topic on CHANNEL.
449 `mode' Yes Sends MODE STRING as mode for
450 CHANNEL.
451 `msg'
452 `names' Yes Shows the nicknames and status of
453 users on CHANNEL.
454 `nextserver' Makes the bot connect to the next
455 server in its server list.
456 `nick' Makes the bot use nickname NICK.
457 `nslookup' Does a nameserver query about NICK
458 host, HOST or IP ADDRESS.
459 `op' Yes Ops NICK on CHANNEL.
460 `part' Yes Makes the bot leave CHANNEL.
461 `password' Changes your password on the bot.
462 Use `NONE' as password if you want
463 to clear it. Do not use this
464 command in public!
465 `reconnect' Makes the bot reconnect to its
466 current server.
467 `rspymessage' Removes you from the spy list.
468 `save' Saves the userlist.
469 `say' Yes Makes the bot say MESSAGE on
470 CHANNEL.
471 `server' Select the server to connect to.
472 SERVER NUMBER is the number of the
473 server in the serverlist.
474 `serverlist' Shows the bot's serverlist.
475 `setfloodrate'
476 `setversion'
477 `shitlist' Shows the bot's shitlist.
478 `spylist' Shows the bot's spylist.
479 `spymessage' Adds you to the spylist
480 `stats' Yes Gives CHANNEL's statistics.
481 `tban' Yes Bans NICK or MASK from CHANNEL for
482 TIME seconds.
483 `tkban' Yes Bans NICK or MASK from CHANNEL for
484 TIME seconds, then kicks him/them
485 because of REASON.
486 `topic' Yes If no TOPICis given, prints
487 CHANNEL's topic. Otherwise, the bot
488 will change CHANNEL's topic to
489 TOPIC.
490 `unlock' Yes Makes the bot unlock topic on
491 CHANNEL
492 `userlist' Shows the bot's userlist
493 `who' Yes Show your level on CHANNEL
494 `whois' Yes Shows information about NICK on
495 CHANNEL
496
497 \1f
498 File: bobot++.info, Node: Scripting, Next: Concept Index, Prev: Using the Bot, Up: Top
499
500 4 Scripting
501 ***********
502
503 Bobot++'s most powerful feature is its scripting system. You write
504 scripts using Guile Scheme. This manual does not cover how to use Guile
505 or how to learn Scheme. *Note Guile Reference Manual: (guile)Top, for
506 the Guile reference manual and
507 `http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html' for a
508 good tutorial on Scheme.
509
510 Note that in previous versions the scripting commands where in the
511 form `bot-FUNCTION'. They are now in the form `bot:FUNCTION'. The old
512 names are still available, but are deprecated and will be removed in
513 Bobot++ 3.0. New commands are only available with the `bot:' prefix.
514 The command `perl -pi -e ``s/bot-/bot:/g'' YOUR-FILES' should be enough
515 to convert your code to use the new functions.
516
517 *NOTE*: All arguments to functions and hooks called by the bot are
518 strings unless otherwise specified.
519
520 * Menu:
521
522 * Adding New Commands::
523 * Hooks::
524 * Scheme User Levels::
525 * Sending Messages::
526 * Misc Scripting Stuff::
527
528 \1f
529 File: bobot++.info, Node: Adding New Commands, Next: Hooks, Prev: Scripting, Up: Scripting
530
531 4.1 Adding New Commands
532 =======================
533
534 Adding a new command is simple. To register a new command use
535 `bot:addcommand'.
536
537 -- Function: bot:addcommand name func needs-channel? num-of-args
538 min-level
539 The NAME is a string representing the name of the command being
540 added. FUNC is a function accepting NUM-OF-ARGS arguments.
541 NEEDS-CHANNEL? is a bool that is true if the function needs the
542 channel name as its first arg, and false otherwise. NUM-OF-ARGS
543 is the number of args FUNC will take and must be within zero (0)
544 and twenty (20). MIN-LEVEL is one of the *Note Scheme User
545 Levels::. A user must be at least a `min-level' user to use the
546 new command. None of the arguments are guaranteed to be passed;
547 if they aren't they are set to the empty string `""'. An example
548 of a new command would be:
549
550 (define (hello channel name)
551 (if (string=? name "")
552 (bot:say channel "Hello world!")
553 (bot:say channel (string-append "Hello " name "!")))
554
555 (bot:addcommand "hello" hello #t 2 0)
556
557 This will display "Hello World!" if called as `!hello' and "Hello
558 World USER" if called as `!hello USER'.
559
560 \1f
561 File: bobot++.info, Node: Hooks, Next: Scheme User Levels, Prev: Adding New Commands, Up: Scripting
562
563 4.2 Hooks
564 =========
565
566 Hooks are a powerful feature of Bobot++. Hooks are a hybrid of ircII
567 and tiny fugue (a MUD bot) hooks with a little bit of extra stuff added
568 in. A hook is called when a regular expression is matched against a
569 message sent to or by the bot.
570
571 Bobot++ uses different hook types for each IRC message type, and also
572 includes a hook for accessing raw irc messages. Hooks are tagged with a
573 priority and a flag that specifies whether to call the next hook that
574 matches after calling the current one or to stop processing.
575
576 Hooks are processed from the highest to lowest priority, with
577 fallthrough hooks of equal priority to non-fallthrough hooks being
578 executed first.
579
580 * Menu:
581
582 * Creating a Hook::
583 * Hook Types::
584
585 \1f
586 File: bobot++.info, Node: Creating a Hook, Next: Hook Types, Prev: Hooks, Up: Hooks
587
588 4.2.1 Creating a Hook
589 ---------------------
590
591 To add a new hook you use the function `bot:addhook'.
592
593 -- Function: bot:addhook type regex function [pri fall name]
594 TYPE specifies the type of hook (the types of hooks are listed in
595 *Note Hook Types::).
596
597 REGEX is a standard regular expression. If REGEX is matched,
598 FUNCTION will be called.
599
600 FUNCTION will take a different number of args depending on the
601 hook type.
602
603 PRI specifies the priority of the hook--higher priority hooks are
604 executed first. This argument is optional and defaults to `0'.
605
606 FALL is `#t' if the hook is a fallthrough hook and `#f' is the
607 hook is not a fallthrough hook. This arg is also optional and
608 defaults to `#t'.
609
610 NAME is the optional name of the hook that defaults to
611 `"DEFAULT"'. If you set the name then you can have more than one
612 hook that matches the same regexp, as long as they have the same
613 name. E.g. in a log script you could have the regexps for the log
614 function all be `".*"' and set their names to `"log"' to avoid a
615 conflict with other hooks.
616
617 \1f
618 File: bobot++.info, Node: Hook Types, Prev: Creating a Hook, Up: Hooks
619
620 4.2.2 Hook Types
621 ----------------
622
623 The following sections document the different hooks Bobot++ exposes.
624
625 The general format of each hook description is as if it were a
626 function to be defined, but these describe the function to be passwd to
627 `bot:add-hook'. Do _not_ name your functions these names.
628
629 That said, here is the list of available hooks functions. FIXME:
630 write docs
631
632 * Menu:
633
634 * Received Message Hooks::
635 * Sent Message Hooks::
636 * DCC CHAT Hooks::
637 * Miscellaneous Hooks::
638
639 \1f
640 File: bobot++.info, Node: Received Message Hooks, Next: Sent Message Hooks, Prev: Hook Types, Up: Hook Types
641
642 4.2.2.1 Receieved Message Hooks
643 ...............................
644
645 The following hooks are triggered when a mesage is received by the bot.
646
647 -- Function: hooks/action from to action
648 This hook is triggered when someone performs an action.
649
650 FROM is the nickname the person that performed the action.
651
652 TO is the target of the action, which is either a channel or the
653 Bot's nick if the user private messages the bot.
654
655 ACTION is the text of the action. E.g. if someone did `* foobar
656 does baz', then ACTION would be the string `"does baz"'.
657
658 -- Function: hooks/nickname old-nick new-nick
659 This hook is called when someone changes his nickname from
660 OLD-NICK to NEW-NICK.
661
662 -- Function: hooks/signoff nick message
663 This hook is called when someone signs off of IRC.
664
665 NICK is the nickname of the person signing off.
666
667 MESSAGE is his quit message
668
669 -- Function: hooks/ctcp nick to command rest
670 This hook is called when a CTCP request is received by the bot.
671
672 NICK is the nickname of the sender.
673
674 TO is the target of the CTCP request. This will either be a
675 channel the bot is in, or the nickname of the bot.
676
677 COMMAND is the CTCP command issued.
678
679 REST contains the arguments to the CTCP command.
680
681 -- Function: hooks/ctcp-reply nick command rest
682 This hook is called when a CTCP REPLY is received. This occurs when
683 the bot has sent a CTCP request to another client. The CTCP REPLY
684 is always addressed to the bot directly.
685
686 NICK is the nickname of the person who replied.
687
688 COMMAND is the command to which NICK is replying.
689
690 REST contains the body of the reply.
691
692 -- Function: hooks/disconnect server intentional
693 This is called when the bot is disconnected from a server.
694
695 SERVER is the hostname of the server from which the bot was
696 disconnected.
697
698 INTENTIONAL is a flag set to `#t' when the bot disonnected from
699 the server as the result of a command (issued by a user from IRC,
700 SIGHUP, or from a script), or `#f' when the bot disconnected from
701 the server unintentionally..
702
703 -- Function: hooks/invite nick channel
704 This hook is called when a user invited the bot to join a channel.
705
706 NICK is the nickname of the user who sent the invite.
707
708 CHANNEL is the channel to which the bot was invited.
709
710 -- Function: hooks/join nick channel
711 This is called when a user or the bot joins a channel.
712
713 NICK is the nickname of the user who joined CHANNEL. This may be
714 the bot's nickname (the IRC server sends the JOIN command back to
715 the the bot after it joins a channel).
716
717 CHANNEL is the channel that was joined
718
719 -- Function: hooks/kick target from channel reason
720 This hook is called when a user, including the bot, is kicked out
721 of a channel.
722
723 TARGET is the nick of the user who was kicked. This may be the
724 bot's nick.
725
726 FROM is the nick of the user who issued the kick. This may also be
727 the bot's nick.
728
729 CHANNEL is the channel the kick was issued in.
730
731 REASON is the reason the user was kicked.
732
733 -- Function: hooks/part nick channel
734 This hook is called when a user parts a channel.
735
736 NICK is the user who parted the channel. This may be the bot.
737
738 CHANNEL is the channel from which the user parted.
739
740 -- Function: hooks/mode nick target modes
741 This hook is called when someone sets the modes of TARGET.
742
743 NICK is the user who set the modes. This may be the bot.
744
745 TARGET is the target of the MODE command. This may be a channel or
746 a user. If it is a user, it may be the bot.
747
748 MODES is the MODE string.
749
750 -- Function: hooks/message nick message
751 This hook is called when someone sends a private message to the
752 bot.
753
754 NICK is the nickname of the user who sent the message.
755
756 MESSAGE is the message the user sent.
757
758 -- Function: hooks/notice nick message
759 This hook is called when a user send a private notice to the bot.
760
761 NICK is the user who sent the notice.
762
763 MESSAGE is the message the user sent.
764
765 -- Function: hooks/public nick channel message
766 This hook is called when a user sends a normal message to a
767 channel.
768
769 NICK is the user who sent the message.
770
771 CHANNEL is the channel to which the message was sent.
772
773 MESSAGE is the message that was sent.
774
775 -- Function: hooks/public-notice nick channel message
776 This hook is called when a user send a notice to a channel.
777
778 NICK is the user who sent the notice.
779
780 CHANNEL is the channel to which the notice was sent.
781
782 MESSAGE is the message that was sent.
783
784 -- Function: hooks/raw raw-message
785 This hook is called every time a message is received. This matches
786 on the raw message text and passes the hook function the raw IRC
787 message.
788
789 RAW-MESSAGE is the raw IRC message.
790
791 -- Function: hooks/topic nick channel new-topic
792 This hook is called when a user changes the topic in a channel.
793
794 NICK is the user who set the topic. This may be the bot.
795
796 CHANNEL is the channel that's topic was changed.
797
798 NEW-TOPIC is the new topic.
799
800 \1f
801 File: bobot++.info, Node: Sent Message Hooks, Next: DCC CHAT Hooks, Prev: Received Message Hooks, Up: Hook Types
802
803 4.2.2.2 Sent Message Hooks
804 ..........................
805
806 These hooks are called when the bot sends a message. MYNICK is always
807 the bot's nick and will not be documented in each hook description.
808
809 -- Function: hooks/send/public mynick channel message
810 This hook is called when the bot sends a normal message to a
811 channel.
812
813 CHANNEL is the channel to which the bot sent the message.
814
815 MESSAGE is the message the bot sent.
816
817 -- Function: hooks/send/message mynick to message
818 This hook is called when the bot sends a private message to a user.
819
820 TO is the nick of the user to whom the message was sent.
821
822 MESSAGE is the message that was sent.
823
824 -- Function: hooks/send/action mynick to message
825 This hook is called when the bot sents an action to a channel or a
826 user.
827
828 TO is the channel or nick of the user to which the action was sent.
829
830 MESSAGE is the text of the action.
831
832 -- Function: hooks/send/ctcp mynick to command message
833 This hook is called when the bot sends a CTCP message _other than_
834 an ACTION to a channel or user.
835
836 TO is the channel or nick of the user to which the CTCP was sent.
837
838 COMMAND is the CTCP command that was sent.
839
840 MESSAGE is a string containing the arguments to the CTCP command.
841
842 \1f
843 File: bobot++.info, Node: DCC CHAT Hooks, Next: Miscellaneous Hooks, Prev: Sent Message Hooks, Up: Hook Types
844
845 4.2.2.3 DCC CHAT Hooks
846 ......................
847
848 These hooks are called when a user initializes a DCC CHAT and when the
849 bot receives messages from the user in a DCC CHAT.
850
851 -- Function: hooks/dcc/chat-begin from
852 This hook is called when a user begins a DCC CHAT with the bot.
853 FROM is the user's address in the form `nick!user@host'.
854
855 -- Function: hooks/dcc/chat-end address
856 This hook is called when a DCC CHAT is purged after being idle for
857 a while, or when the user closes the DCC CHAT. As such, you cannot
858 write any more data to the DCC CHAT.
859
860 ADDRESS is the address (nick!user@host) of the person on the other
861 side of the DCC.
862
863 -- Function: hooks/dcc/chat-message from message
864 This hook is called when a user sends a message to the bot through
865 a DCC CHAT.
866
867 FROM is the user's address in the form `nick!user@host'.
868
869 MESSAGE is the message the user sent to the bot.
870
871 \1f
872 File: bobot++.info, Node: Miscellaneous Hooks, Prev: DCC CHAT Hooks, Up: Hook Types
873
874 4.2.2.4 Miscellaneous Hooks
875 ...........................
876
877 -- Function: hooks/flood nick
878 This hook is called when a user is detected flooding the bot.
879
880 NICK is the nickname of the user flooding the bot.
881
882 -- Function: hooks/timer time
883 This hook is called once a minute. The regex is *not* used.
884
885 TIME is the in zero-padded `hh:mm' format.
886
887 \1f
888 File: bobot++.info, Node: Scheme User Levels, Next: Sending Messages, Prev: Hooks, Up: Scripting
889
890 4.3 Scheme User Levels
891 ======================
892
893 There are five levels that a user may be when interfacing with a bot:
894 NONE, USER, TRUSTED_USER, FRIEND, MASTER. The Scheme variables for the
895 user levels are `bot:user-none', `bot:user-user', `bot:user-trusted',
896 `bot:user-friend', and `bot:user-master'. See *Note User Levels:: for
897 more information on User Levels.
898
899 When adding a new command, think about who should be able to use it.
900 Is your command a general purpose command that helps the channel (e.g.
901 `!seen') that everyone should be able to use? Or is it something that
902 should be restricted? See *Note User Levels:: for information on what
903 level users can do what with the built in bot commands and think about
904 what level a user your command is targetted towards. You must be _very_
905 careful when giving new commands to lower level users because you can
906 do basically everything the bot can do with a script. As the scripting
907 interface becomes more powerful, you must think more about what users
908 can use new commands you add.
909
910 \1f
911 File: bobot++.info, Node: Sending Messages, Next: Misc Scripting Stuff, Prev: Scheme User Levels, Up: Scripting
912
913 4.4 Sending Messages
914 ====================
915
916 There are several types of messages you can send with Bobot++ from
917 scripts. There is the simple, but rather limited, `bot:say',
918 `bot:action' and `bot:msg', and the more powerful, but lower level,
919 `bot:send-MESSAGE' functions. Most bots will probably only need the
920 higher level functions, but for the sake of why-not Bobot++ lets you
921 use the lower level functions (in progress).
922
923 * Menu:
924
925 * High Level Message Functions::
926 * Low Level Message Functions::
927
928 \1f
929 File: bobot++.info, Node: High Level Message Functions, Next: Low Level Message Functions, Prev: Sending Messages, Up: Sending Messages
930
931 4.4.1 "High Level" Message Functions
932 ------------------------------------
933
934 -- Function: bot:say channel message
935 Send a public or private MESSAGE to CHANNEL.
936
937 Sends a normal text message, as if a user had typed it in. The
938 DEST can be a nickname or a channel.
939
940 -- Function: bot:action channel message
941 Send an "action" type MESSAGE to CHANNEL
942
943 -- Function: bot:msg nick message
944 The same as if a user typed `/msg nick message' to their IRC
945 client.
946
947 -- Function: bot:notice target message
948 Sends MESSAGE as a NOTICE to TARGET. TARGET may be a user (nick)
949 or a channel. This returns 0 on success.
950
951 \1f
952 File: bobot++.info, Node: Low Level Message Functions, Prev: High Level Message Functions, Up: Sending Messages
953
954 4.4.2 "Low Level" Message Functions
955 -----------------------------------
956
957 The "Low Level" messaging functions allow you to do things like send
958 CTCP messages. You probably want to read rfc 2812 and the CTCP spec
959 before using these. If you have no idea what these do, read rfc 2812
960 (IRC Client Protocol) and CTCP spec. These functions all return
961 `*unspecified*' always, so don't use the return value for anything.
962
963 -- Function: bot:send-ctcp to command message
964 TO is the target of your CTCP message, COMMAND is the CTCP
965 command, and MESSAGE is the message (or arguments) of the command.
966 Make sure to `bot:ctcp-quote' the message!
967
968 -- Function: bot:send-ctcp-reply to command message
969 TO is the target of your CTCP reply, COMMAND is the CTCP command,
970 and MESSAGE is the message (or arguments) of the command. Make
971 sure to `bot:ctcp-quote' the message!
972
973 This is used to reply to a ctcp that the bot has received.
974
975 \1f
976 File: bobot++.info, Node: Misc Scripting Stuff, Prev: Sending Messages, Up: Scripting
977
978 4.5 Misc. Scripting Stuff
979 =========================
980
981 These are a few useful things that I thought people writing scripts
982 might want to know.
983
984 If you want to execute code when the bot exits, just do `add-hook!
985 bot:exit-hook THUNK' where THUNK is an argumentless procedure (a
986 thunk). When the bot exits your thunk will be called.
987
988 [ I didn't know where to put any of these, so I just stuck them in
989 here.
990
991 There probably needs to be several sections added, like dealing
992 with users (kicking, added, etc), dealing with the bot (channels,
993 nickname of the bot, etc), server issues (serverlist), useful
994 tools (nslookup, whois), and do on. ]
995
996 -- Function: bot:adduser nick-or-mask cbannel-mask level prot auto-op
997 Adds an user to the userlist, for a `nick!user@host' matching the
998 one given, on a channel matching the CHANNELMASK given.
999
1000 The LEVEL can be: The PROT can be: The AUTO-OP can be:
1001 0 - No level 0 - No protection 0 - No auto-op
1002 1 - User 1 - No ban 1 - Op on join
1003 2 - Trusted User 2 - No kick
1004 3 - Friend 3 - No deop
1005 4 - Master
1006
1007
1008 -- Function: bot:addserver hostname ip-address [portnumber]
1009 Adds the server specified by HOSTNAME or IP-ADDRESS to the server
1010 list.
1011
1012 -- Function: bot:addshit nick-or-mask channel-mask level [time reason]
1013 Adds an user to the shitlist, for a nick!user@host matching the
1014 one given, on a channel matching the CHANNELMASK given.
1015
1016 The LEVEL can be:
1017 0 - No shit
1018 1 - No op
1019 2 - Kick and Ban on join
1020 3 - Kick and Ban on join, no deban
1021
1022
1023 -- Function: bot:ban channel mask-or-nick
1024 Bans MASK or NICK from CHANNEL. You need to be a trusted user to
1025 ban with a MASK.
1026
1027 -- Function: bot:change-command-level nick-or-mask channel-mask
1028 new-level
1029 Gives NICK or MASK level NEW-LEVEL on channel(s) CHANNEL-MASK.
1030 Note that you can not change level for someone whose level is
1031 greater than yours, and that you can not give a level greater than
1032 yours.
1033
1034 -- Function: bot:cycle channel
1035 Makes the bot leave and join CHANNEL.
1036
1037 -- Function: bot:deban channel mask-or-nick
1038 Debans MASK or NICK from CHANNEL. You need to be a trusted user to
1039 deban with a MASK.
1040
1041 -- Function: bot:delserver server-number
1042 Deletes server from server list whose number in the server list is
1043 SERVER-NUMBER
1044
1045 -- Function: bot:deluser nick-or-mask channel-mask
1046 Removes NICK or MASK from the userlist.
1047
1048 -- Function: bot:delshit nick-or-mask channel-mask
1049 Removes NICK or MASK from the shitlist.
1050
1051 -- Function: bot:deop channel mask-or-nick
1052 Deops MASK or NICK on CHANNEL.
1053
1054 -- Function: bot:die reason
1055 Makes the bot stop immediately.
1056
1057 -- Function: bot:do ?
1058
1059 -- Function: bot:invite channel nick
1060 Invites NICK on CHANNEL.
1061
1062 -- Function: bot:join channel
1063 Makes the bot join CHANNEL.
1064
1065 -- Function: bot:keep channel modes
1066 Sets the MODES that the bot will keep for CHANNEL. See also STATS.
1067
1068 -- Function: bot:kick channel mask-or-nick [reason]
1069 Kicks MASK or NICK out of CHANNEL, because of REASON. You need to
1070 be a trusted user to use a MASK.
1071
1072 -- Function: bot:kickban channel mask-or-nick [reason]
1073 Bans then kicks MASK or NICK out of CHANNEL, because of REASON.
1074 You need to be a trusted user to use a MASK.
1075
1076 -- Function: bot:lock channel
1077 Locks topic on CHANNEL.
1078
1079 -- Function: bot:logport
1080 [ Probably returns the log port? ]
1081
1082 -- Function: bot:mode channel mode-string
1083 Sends MODE-STRING as mode for CHANNEL.
1084
1085 -- Function: bot:nextserver
1086 Makes the bot connect to the next server in its server list.
1087
1088 -- Function: bot:nick nick
1089 Makes the bot use nickname NICK.
1090
1091 -- Function: bot:op channel nick
1092 Ops NICK on CHANNEL.
1093
1094 -- Function: bot:part channel
1095 Makes the bot leave CHANNEL.
1096
1097 -- Function: bot:reconnect
1098 Makes the bot reconnect to its current server.
1099
1100 -- Function: bot:server server-number
1101 Select the server to connect to. SERVER-NUMBER is the number of
1102 the server in the serverlist.
1103
1104 -- Function: bot:setfloodrate ?
1105
1106 -- Function: bot:setversion ?
1107
1108 -- Function: bot:tban channel nick-or-mask time
1109 Bans NICK or MASK from CHANNEL for TIME seconds.
1110
1111 -- Function: bot:tkban channel nick-or-mask time [reason]
1112 Bans NICK or MASK from CHANNEL for TIME seconds, then kicks
1113 him/them because of REASON.
1114
1115 -- Function: bot:topic channel topic
1116 If no TOPIC is given, prints CHANNEL's topic. Otherwise, the bot
1117 will change CHANNEL's topic to TOPIC.
1118
1119 -- Function: bot:unlock channel
1120 Makes the bot unlock topic on CHANNEL.
1121
1122 -- Function: bot:getnickname
1123 [ Gets the bot's nickname? ]
1124
1125 -- Function: bot:getserver
1126
1127 -- Function: bot:getserverlist
1128
1129 -- Function: bot:flush
1130 [ Flushes the socket to the server? ]
1131
1132 -- Function: bot:flushport
1133 [ Flushes the log port? ]
1134
1135 -- Function: bot:random ?
1136 [ Returns a random number? What range? Why? ]
1137
1138 -- Function: bot:delcommand
1139 [ Probably deletes a command added with `bot:addcommand' ? ]
1140
1141 -- Function: bot:addtimer ? ?
1142
1143 -- Function: bot:deltimer ?
1144
1145 -- Function: bot:dcc-chat-send ? ?
1146
1147 [ And what about the stuff defined in `bobot-utils.scm' ? I just
1148 added it here so it could be somewhere. There should also be a
1149 section dealing with modules. How to use them. What module
1150 scripts are in. What module bobot++ provided primites are in.
1151 And so on. ]
1152
1153 -- Function: bot:log . messages
1154 Write as many MESSAGES as you want to the log. If the arg is a
1155 thunk it will be executed and it's output will be written to the
1156 log.
1157
1158 -- Function: bot:load file
1159
1160 -- Function: bot:load-module module-spec
1161
1162 -- Function: bot:use-module module-spec
1163
1164 -- Function: bot:match-not-channel regex
1165 match-not-channel adds a prefix regex to your REGEX so it doesn't
1166 match the sender or channel in a PUBLIC message
1167
1168 -- Function: bot:match-to-me regex
1169 match-to-me matches text that was addressed to the bot with a ':',
1170 ',', or nothing after the bot name.
1171
1172 -- Function: bot:sent-to-me? message
1173
1174 -- Function: bot:ctcp-quote message
1175 Returns the CTCP quoted message Input _MUST NOT_ contain the
1176 trailing `\r\n' (it is added by the message sending code).
1177
1178 -- Variable: %bot:loadpath
1179
1180 -- Function: %bot:load-extensions
1181
1182 \1f
1183 File: bobot++.info, Node: Concept Index, Next: Function Index, Prev: Scripting, Up: Top
1184
1185 Concept Index
1186 *************
1187
1188