| |
- Bot
- asynchat.async_chat(asyncore.dispatcher)
-
- IRCClient
class Bot |
|
RDQL-speaking IRC Bot |
|
Methods defined here:
- __init__(self, channels)
- Load channels from file, load commands from file, start connecting.
- addns(self, m, origin, args, text)
- Add a namespace to the common_namespaces set
- bye(self, origin, args, text)
- good bye
- catchall(self, m, origin, args, text)
- # A catchall, designed to catch anything starting with ^
- command_list(self, m, origin, args, text)
- List available commands, or, if asked for information on a specific command, return the RDQL query behind it.
- connect(self, host, port)
- forget_query(self, m, origin, args, text)
- Forget a stored query.
- help(self, m, origin, args, text)
- Help function for in-channel help with commands.
- info(self, m, origin, args, text)
- General information function.
- join_channel(self, m, origin, args, text)
- What to do when told to ^join a channel.
- listns(self, m, origin, args, text)
- List namespaces available to the bot from the common_namespaces function, sorted alphabetically
- load_command_dict(self)
- Load command dictionary from the file commandlist.crs.
- main_loop(self)
- new_query(self, m, origin, args, text)
- Add a new query to the command database. Useful for
common queries like mailbox, aim name, etc.
- ns(self, m, origin, args, text)
- Return the stored URL for a namespace. Useful for creating queries or documents.
- on_invite(self, m, origin, args, text)
- What to do when invited to a cahnnel.
- part_channel(self, m, origin, args, text)
- Response to a ^part command.
- prenamespaced_query(self, m, origin, args, text)
- Uses common namespaces to create a query so that you don't have to worry about bindings.
- put(self, m, origin, args, text)
- Put/Add is the way to add statements to the Model/Graph. It
uses URL lib to fetch the URL, and then dumps it.
- queries(self, commandname, commandparams, m, origin, args, text)
- Run stored queries.
- query(self, m, origin, args, text)
- Run queries against current RDF store. Queries are in RDQL.
- reload_commands(self, m, origin, args, text)
- Reloads the stored command dictionary. Only useful if you have two different sources modifing the dictionary for some reason.
- reply_to(self, origin, args)
- Built in IRC reply to to determine whether we reply to user or channel.
- run_command(self, m, origin, args, text)
- Runs commands stored via newquery.
- save_command_dict(self)
- Saves the current command dictionary to a file.
- spam(self, m, origin, args, text)
- spam is not good
- tell(self, origin, args, msg)
- Built in tell function so we don't have to always use reply_to in later functions.
|
class IRCClient(asynchat.async_chat) |
|
Implement part of the IRC protocol on top of async_chat |
|
- Method resolution order:
- IRCClient
- asynchat.async_chat
- asyncore.dispatcher
Methods defined here:
- __init__(self)
- Set up nickname, channels, other information
- bind(self, callback, command, textPat=None, doc=None)
- callback is the routine to bind; it's called ala
callback(matchObj or None, origin, args, text)
command is one of the commands above, e.g. PRIVMSG
textpat is None or a regex object or string to compile to one
doc should be a list of strings; each will go on its own line
- collect_incoming_data(self, bytes)
- append bytes to buffer
- found_terminator(self)
- called by asyncore when terminator found in stream
- handle_connect(self)
- callback on connect
- makeConn(self, host, port)
- connect to host, port
- notice(self, dest, text)
- send a NOTICE to dest, a channel or user
- process_msg(self, args, text, origin)
- process newly received message
- startChannels(self, channels)
- connect to channels
- tell(self, dest, text)
- send a PRIVMSG to dest, a channel or user
- todo(self, args, *text)
- queue command
Methods inherited from asynchat.async_chat:
- close_when_done(self)
- automatically close this channel once the outgoing queue is empty
- discard_buffers(self)
- get_terminator(self)
- handle_close(self)
- handle_read(self)
- handle_write(self)
- initiate_send(self)
- push(self, data)
- push_with_producer(self, producer)
- readable(self)
- predicate for inclusion in the readable for select()
- refill_buffer(self)
- # refill the outgoing buffer by calling the more() method
# of the first producer in the queue
- set_terminator(self, term)
- Set the input delimiter. Can be a fixed string of any length, an integer, or None
- writable(self)
- predicate for inclusion in the writable for select()
Data and other attributes inherited from asynchat.async_chat:
- ac_in_buffer_size = 4096
- ac_out_buffer_size = 4096
Methods inherited from asyncore.dispatcher:
- __getattr__(self, attr)
- # cheap inheritance, used to pass all other attribute
# references to the underlying socket object.
- __repr__(self)
- accept(self)
- add_channel(self, map=None)
- close(self)
- connect(self, address)
- create_socket(self, family, type)
- del_channel(self, map=None)
- handle_accept(self)
- handle_error(self)
- handle_expt(self)
- handle_expt_event(self)
- handle_read_event(self)
- handle_write_event(self)
- listen(self, num)
- log(self, message)
- log_info(self, message, type='info')
- recv(self, buffer_size)
- send(self, data)
- set_reuse_addr(self)
- set_socket(self, sock, map=None)
Data and other attributes inherited from asyncore.dispatcher:
- accepting = 0
- addr = None
- closing = 0
- connected = 0
- debug = 0
| |