/[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.10 - (show annotations) (download)
Tue Jun 22 20:47:38 2004 UTC (15 years, 1 month ago) by wcc
Branch: MAIN
Changes since 1.9: +58 -239 lines
* Added server_find script command (server_del, etc needs a server number,
  and there was no way to get one).
* Start of some doc stuff.. I'm going to get SCRIPTING-COMMANDS up to date,
  and then start on an XML doc system (need sample content first).

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23