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