/[cvs]/eggdrop1.9/doc/SCRIPTING-COMMANDS
ViewVC logotype

Contents of /eggdrop1.9/doc/SCRIPTING-COMMANDS

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.11 - (show annotations) (download)
Thu Jun 24 06:19:56 2004 UTC (15 years, 3 months ago) by wcc
Branch: MAIN
CVS Tags: HEAD
Changes since 1.10: +178 -90 lines
* Added nick_find script comamnd, to aid in deleting a nick.
* Fix from last commit re server_find.
* Finished documenting server module script commands.
* Adding doc/TAGS and starting doc/TODO.

1 $Id: tcl-commands.doc,v 1.113 2004/06/11 17:46:14 wcc Exp $
2
3 Eggdrop Scripting Commands
4 Last revised: July 22, 2004
5 _________________________________________________________________
6
7 Eggdrop Scripting Commands
8
9
10 This is an exhaustive list of all of the scripting commands added to Eggdrop.
11 All of the normal built-in commands specific to the scripting module you are
12 using are still there, of course, but you can also use these to manipulate
13 features of the bot. They are listed according to category. This list is
14 accurate for Eggdrop v1.9.0.
15
16 Unless otherwise specified, commands return 0.
17
18 *** CORE COMMANDS ***
19
20 putlog <text>
21 Description: sends text to the bot's logfile, marked as 'misc' (o)
22 Returns: nothing
23 Module: core
24
25 putloglev <level(s)> <channel> <text>
26 Description: sends text to the bot's logfile, tagged with all of the
27 valid levels given. Use "*" to indicate all log levels.
28 Returns: nothing
29 Module: core
30
31 <DXX: SCRIPTING-COMMANDS docs for the core.>
32
33
34 *** SERVER MODULE COMMANDS ***
35
36 Channel Commands:
37
38 channel_list
39 Returns:
40 The list of channels that the bot is currently on.
41
42 channel_members <chan>
43 Returns:
44 The list of nicks on the given channel.
45
46 channel_mode <chan> [nick]
47 Returns:
48 Either the mode of the channel, with no arguments (such as key),
49 or the mode of the nick on that channel (if given).
50
51 channel_mask_list <chan> <type>
52 Returns:
53 The list of bans, exempts, or invites in the channel. Each item of the
54 list is itself a list of the form {mask, who_set_it, when_it_was_set}.
55
56 channel_key <chan>
57 Returns:
58 The key of the given channel.
59
60 channel_limit <chan>
61 Returns:
62 The limit of the given channel.
63
64 channel_topic <chan>
65 Returns:
66 The topic, nick that set the topic, and time the topic was set for the
67 specified channel.
68
69
70
71 Botnick Commands:
72
73 nick_add <nick>
74 Description:
75 Adds a nick to the bot's list of nicks. If the first nick in the list
76 cannot be used, the next nick will be used. If all nicks cannot be used,
77 a random nick starting with "egg" will be used.
78
79 nick_del <nick number>
80 Description:
81 Removes a nick from the bot's list of nicks.
82 Returns:
83 0 for success; -1 otherwise.
84
85 nick_clear
86 Description:
87 Clears the bot's list of nicks.
88
89 nick_find <nick>
90 Returns:
91 The nick number corresponding to the specified nick, or -1 if not found.
92
93 isbotnick <nick>
94 Returns:
95 1 if the specified nick matches the bot's current nick; 0 otherwise.
96
97
98
99 DCC Commands:
100
101 dcc_chat <nick> [timeout]
102 Description:
103 Starts a dcc chat with the specified nick. Timeout is specified in
104 seconds. Specify 0 to use the default timeout, or -1 for no timeout.
105 Returns:
106 An unconnected idx, or -1 on failure.
107
108 dcc_send <nick> <filename> [timeout]
109 Description:
110 Starts a dcc send to the given nick. Resumes are handled automatically.
111 Timeout is specified in seconds. Specify 0 to use the default timeout,
112 or -1 for no timeout.
113 Returns:
114 An unconnected idx, -2 if the file could not be opened, or -1 on other
115 failure.
116
117 dcc_send_info <idx> <stat-type>
118 Returns:
119 Information about a DCC send. <stat-type> may be one of:
120
121 connect_time - The time the DCC send connection was actually
122 established.
123 request_time - The (unixtime) time the DCC send was initiated
124 or accepted.
125 bytes_left - The number of bytes remaining to be sent.
126 bytes_sent - The number of bytes already sent.
127 total_cps - The average CPS (Characters Per Second) since the send
128 began.
129 snapshot_cps - The average CPS (Characters Per Second) over the last
130 several seconds.
131
132 dcc_accept_send <nick> <localfile> <remotefile> <size> <resume> <ip> <port> [timeout]
133 Description:
134 Accepts a dcc send, as triggered by the dcc_recv bind. Timeout is specified
135 in seconds. Specify 0 to use the default timeout, or -1 for no timeout.
136 Returns:
137 An unconnected idx, or -1 on failure.
138
139
140
141 Input / Output Commands:
142
143 putserv [queue] [next] <text>
144 Description:
145 Sends text to the IRC server.
146
147 Queue may be one of:
148
149 normal - Messages are sent at a normal rate.
150 fast - Messages are sent at a rate faster than "normal".
151 slow - Messages are sent at a rate slower than "normal".
152 noqueue - Messages are not queued. They are sent out to the server
153 immediatly. WARNING: The bot can flood off easily when
154 using this mode.
155
156 If "next" is specified, the message will be moved to the front of the
157 queue.
158
159 server_fake_input <text>
160 Description:
161 Causes the server module to interpret the given text as if the server
162 had sent it.
163
164
165
166 Server List Commands:
167
168 server_add <host> [port] [password]
169 Description:
170 Adds a server to the server list.
171
172 server_del <server number>
173 Description:
174 Removes a server from the server list.
175 Returns:
176 0 for success; -1 otherwise.
177
178 server_clear
179 Description:
180 Clears the server list.
181
182 server_find <host> [port] [password]
183 Returns:
184 The server number matching the server details specified. -1 will be
185 returned if the server could not be found in the list.
186
187 jump [server number]
188 Description:
189 Jumps the bot to the server corresponding to the given server number.
190 If no server number is specified, the next server in the list will be
191 used.
192
193
194
195 005 Commands:
196
197 server_support_val <field>
198 Description:
199 Provides an interface to the 005 numeric.
200 Returns:
201 The value of the field (parsed from fieldname=fieldvalue). Use
202 server_supports instead for items with no value.
203
204 server_supports <value>
205 Description:
206 Provides an interface to the 005 numeric for items with no value.
207 Returns:
208 1 if the value is supported by the server; 0 otherwise.
209
210
211
212 Queue Commands:
213
214 server_queue_len <queue> [next]
215 Returns:
216 The number of messages in the given queue. [queue] may be one of: "fast",
217 "slow", or "normal". If "next" is specified, only messages with the "next"
218 flag (as with putserv [queue] next) are counted.
219
220 server_queue_get [queue] [next] <msgnum>
221 Description:
222 Allows scripts to read the server's output queues. Messages start at
223 number 0. If [queue] isn't given, the normal queue is assumed. If the
224 message was queued with the "next" flag, then then "next" flag must be
225 used to retrieve it.
226 Returns:
227 The text of the desired message; or nothing if not found.
228
229 server_queue_set [queue] [next] <msgnum> <msg>
230 Description:
231 Allows scripts to overwrite messages in the server's output queues.
232 [queue] and [next] work exactly as with server_queue_get and
233 server_queue_set.
234 Returns:
235 0 on success; -1 otherwise.
236
237 server_queue_insert [queue] [next] <msgnum> <msg>
238 Description:
239 Inserts messages into the given output queue. The message that was
240 previously at <msgnum> will be moved back in the queue. To add a message
241 to the end, make <msgnum> larger than the current queue length. Or use
242 putserv :)
243
244
245
246 Misc Server Commands:
247
248 get_uhost <nick>
249 Returns:
250 The uhost for the given nick, or "" if unknown.
251
252 irccmp <str1> <str2>
253 Description:
254 Compares str1 and str2 case independently, as specified by the current
255 server's method of string comparison. Typical uses are comparing nicks
256 and channel names.
257 Returns:
258 < 0 if str1 < str2
259 = 0 if str1 = str2
260 > 0 if str1 > str2
261
262
263
264 *** SCRIPT MODULE COMMANDS ***
265
266 <WRITE ME>
267
268
269
270 *** GLOBAL VARIABLES ***
271
272 botnick
273 Value: the current nickname the bot is using on IRC
274 Module: server
275
276 server
277 Value: the server list index of the current server the bot is using
278 Module: server
279
280 servidx
281 Value: the idx of the server socket
282 Module: server
283
284 <FINISH ME>
285
286
287 *** BINDS ***
288
289 <WRITE ME>
290
291 *** NETWORK COMMANDS ***
292
293 net_listen <port>
294 Description: Opens a listening port. If <port> is in use, it will try up to
295 20 higher ports until a free one is found.
296 Returns: A list of 2 items: The new idx, and the real port being used.
297 Notes: When an incoming connection is accepted, the "newclient" event will
298 execute.
299
300 net_open <host> <port> [timeout]
301 Description: Opens an async connection to the given host and port. If
302 'host' is not an ip address, a dns lookup is performed without blocking.
303 The 'timeout' optional parameter lets you specify a connection timeout
304 in milliseconds. If not given, or if the value is 0, then eggdrop's
305 default timeout value is used. If given as -1, no timeout is used.
306 Returns: A valid idx in an unconnected state.
307 Notes: When the connection is established, the "connect" event will
308 execute. If there is a dns error, a connection error, or the timeout
309 elapses, the "eof" event will execute with the appropriate error code.
310 Use the net_handler command to set handlers for these events.
311
312 net_close <idx>
313 Description: Close the given idx.
314 Returns: 0 for success, -1 if the idx is invalid or already closed.
315
316 net_write <idx> <text> [len]
317 Description: Writes data to an idx.
318 Returns: The number of bytes written to the actual network interface, or
319 -1 upon error.
320 Notes: Any unwritten data is buffered and will be written as soon as
321 possible. Use the 'len' parameter if you are writing binary data which
322 contains embedded NULL's, otherwise the C strlen() function is used to
323 determined the number of bytes to write.
324
325 net_handler <idx> <event> [callback]
326 Description: Sets or unsets a callback for a particular event on an idx.
327 The syntax of the callback varies with the event:
328 connect_callback <idx> <peer_ip> <peer_port>
329 Called when the idx establishes an outgoing connection.
330 newclient_callback <idx> <newidx> <peer_ip> <peer_port>
331 Called when an incoming connection is established.
332 eof_callback <idx> <err> <errmsg>
333 Called when eof is detected or there is an error, such as when the
334 connection times out or is refused by the host.
335 read_callback <idx> <data> <len>
336 Called when data is ready on the idx, after any filtering has been
337 performed. (For more information, see net_linemode.)
338 written_callback <idx> <len> <remaining_len>
339 Called when buffered data has been written in the background.
340 delete_callback <idx>
341 Called when the idx is deleted.
342 Returns: 0 for success, -1 for an invalid idx, -2 for an invalid event type.
343 Notes: To unset a handler, leave off the 'callback' parameter.
344
345 net_info <idx> <what>
346 Description: Provides statistics on a given idx. Possible values for 'what'
347 are:
348 bytesleft - number of buffered bytes remaining to be written
349
350 net_linemode <idx> <on-off>
351 Description: Sets line buffering to either on (1) or off (0) for an idx.
352 When linemode is on, data is buffered until a full line is read. If more
353 than one line is read, the "read" event is triggered for each individual
354 line. The line is passed to the read handler with the end-of-line (either
355 CR, LF, or CRLF) stripped from the data.
356 Returns: Nothing.
357
358 net_throttle <idx> <speed-in> <speed-out>
359 Description: Turn on speed throttling. The values given are in bytes per
360 second.
361 Returns: Nothing.
362 Notes: A speed parameter of <= 0 will disable throttling for that direction.
363
364 net_throttle_in <idx> <speed-in>
365 Description: Modify the 'speed-in' parameter of an already-throttled idx.
366 Returns: Nothing.
367 Notes: A 'speed-in' of <= 0 will disable input throttling.
368
369 net_throttle_out <idx> <speed-out>
370 Description: Modify the 'speed-out' parameter of an already-throttled idx.
371 Returns: Nothing.
372 Notes: A 'speed-out' of <= 0 will disable output throttling.
373
374 net_throttle_off <idx>
375 Description: Removes throttling from an idx.
376
377 *** TCL ONLY ***
378
379 net_add_tcl <channel>
380 Description: Adds a tcl channel to eggdrop's event loop so that its events
381 can be serviced quickly.
382 Returns: Nothing.
383
384 net_rem_tcl <channel>
385 Description: Removes a previously added tcl channel from eggdrop's event
386 loop.
387 Returns: Nothing.
388 _________________________________________________________________
389
390 Copyright (C) 2002, 2003, 2004 Eggheads Development Team

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23