[project @ 2005-06-23 06:20:44 by unknown_lamer]
[clinton/bobotpp.git] / SCRIPTING
CommitLineData
2e20c3e1 1THIS FILE IS OBSOLETE
2The texinfo manual is being written right now, and this is terribly
3incomplete and obsolete.
4
5Basic overview of scripting: (-*- text -*-)
6
7You can use any construct supported by Guile and scripts are always
8run as the master, so BE CAREFUL WHAT YOU PUT IN A SCRIPT!
9
10If you don't know Scheme, then I suggest that you read "Teach Yourself
11Scheme in Fixnum Days" available from
12http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme.html. The
13Guile Scheme reference manual is also a good resource for help on
14Scheme.
15
16See scripts/ for example scripts and the bobot-utils.scm Bot utility
17library. If you have any useful functions that someone writing a bot
18would like to use, please send them to the current maintainer of
19Bobot++ so they can be added to the library. The util library is
20GPLed, as must your scripts be even if you don't use the utils library
21because Bobot++ is GPL, and the commands you use (e.g. bot-addcommand)
22are also GPL...
23
24Guile script are very powerful. You can even write extensions in C and
25use load-extension to load the extension and make it's functions
26available, so you can (in theory at least) do anything with Bobot++
27that you can do with eggdrop (except for DCC because it is disabled
28for now).
29
30Time format help...wherever a time is needed, you must use a string
31that gives the time you want in years after 1970 (because UNIX time
32starts at Midnight January 1, 1970). Format is:
33
34xxYxxMxxDxxHxxmxxs
35
36Y = year, M = month, D = days, H = hours, m = minutes, s = seconds
37Remember that the time is since 0:00 January 1, 1970. I really need to
38write a function that converts dates into the time format used internally.
39
40
41Anyway, read bobot-utils.scm for the docs on the utils. Reading the
42source code (mainly ScriptCommands.[CH]) will help.
43
44Commands:
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
71The 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