[project @ 2005-06-23 06:20:44 by unknown_lamer]
[clinton/bobotpp.git] / SCRIPTING
1 THIS FILE IS OBSOLETE
2 The texinfo manual is being written right now, and this is terribly
3 incomplete and obsolete.
4
5 Basic overview of scripting: (-*- text -*-)
6
7 You can use any construct supported by Guile and scripts are always
8 run as the master, so BE CAREFUL WHAT YOU PUT IN A SCRIPT!
9
10 If you don't know Scheme, then I suggest that you read "Teach Yourself
11 Scheme in Fixnum Days" available from
12 http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html. The
13 Guile Scheme reference manual is also a good resource for help on
14 Scheme.
15
16 See scripts/ for example scripts and the bobot-utils.scm Bot utility
17 library. If you have any useful functions that someone writing a bot
18 would like to use, please send them to the current maintainer of
19 Bobot++ so they can be added to the library. The util library is
20 GPLed, as must your scripts be even if you don't use the utils library
21 because Bobot++ is GPL, and the commands you use (e.g. bot-addcommand)
22 are also GPL...
23
24 Guile script are very powerful. You can even write extensions in C and
25 use load-extension to load the extension and make it's functions
26 available, so you can (in theory at least) do anything with Bobot++
27 that you can do with eggdrop (except for DCC because it is disabled
28 for now).
29
30 Time format help...wherever a time is needed, you must use a string
31 that gives the time you want in years after 1970 (because UNIX time
32 starts at Midnight January 1, 1970). Format is:
33
34 xxYxxMxxDxxHxxmxxs
35
36 Y = year, M = month, D = days, H = hours, m = minutes, s = seconds
37 Remember that the time is since 0:00 January 1, 1970. I really need to
38 write a function that converts dates into the time format used internally.
39
40
41 Anyway, read bobot-utils.scm for the docs on the utils. Reading the
42 source code (mainly ScriptCommands.[CH]) will help.
43
44 Commands:
45 - anything with a ? means that the arg must be either #t or #f
46 - min-level is from 0->4 and is the minimum level a user must be in
47 order to execure the command
48
49
50 (bot-addcommand "name" function [needs channel?] args min-level)
51 - This is how you add a command. You could use this to give level 0
52 users access to a few commands by writing wrappers if you
53 wanted. Just be careful what functions you let lower level users use
54 because you might breach the security of your system! Because you
55 can add commands, you can have the bot do anything (even reboot
56 system if you have the bot running as root...)
57
58 (bot-addhook hook/type "regex" function)
59 - This will add a hook. A hook is executed for a certain type of message
60 (the hook/type) when the regex matches. You can use the full POSIX
61 regex syntax here, including the [[::]] (e.g. [[:alnum:]])
62 extensions (at least on a system using the GNU C Libary). All of the
63 regexps that match for a hook are executed, with the first to be
64 added first. This behavior will change in Bobot++ 2.1 when
65 fallthrough hooks and priorities are introduced.
66
67 If a hook isn't documented here, look in Interp.C
68 and Parser.C for stuff on the Hooks. The docs here will list the
69 number of args and their contents.
70
71 The available hooks are: (add docs!)
72 - hooks/action
73 - hooks/nickname
74 - hooks/signoff
75 - hooks/ctcp
76 - hooks/ctcp-reply
77 - hooks/disconnect
78 - hooks/flood
79 - hooks/invite
80 - hooks/join
81 - hooks/kick
82 - hooks/part
83 - hooks/mode
84 - hooks/message
85 private message to bot
86 2 args - from: user than sent message, text: text of message
87 - hooks/notice
88 - hooks/public
89 public message (everything that happens in a channel except for
90 actions)
91 3 args - from: user that sent message, to: channel, text: message text
92 - hooks/public-notice
93 - hooks/raw
94 - hooks/timer
95 - hooks/topic