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