irc3
Irc bot¶
IrcBot¶
-
class
irc3.
IrcBot
(*ini, **config)[source]¶ An IRC bot
-
defaults
= {'asynchronous': True, 'connection': <class 'irc3.IrcConnection'>, 'ctcp': {'time': '{now:%c}', 'userinfo': '{realname}', 'version': 'irc3 {version} - {url}'}, 'encoding': 'utf8', 'flood_burst': 4, 'flood_rate': 1, 'flood_rate_delay': 1, 'host': 'localhost', 'loop': None, 'max_lag': 60, 'max_length': 512, 'mode': 0, 'nick': 'irc3', 'passwords': {}, 'port': 6667, 'realname': 'Irc bot based on irc3 http://irc3.readthedocs.io', 'server_config': {'CHANMODES': 'eIbq,k,flj,CFLMPQScgimnprstz', 'CHANTYPES': '#', 'PREFIX': '(ov)@+', 'STATUSMSG': '+@'}, 'ssl': False, 'ssl_verify': False, 'testing': False, 'timeout': 320, 'url': 'https://irc3.readthedocs.io/', 'username': 'irc3'}¶
-
add_signal_handlers
()¶ Register handlers for UNIX signals (SIGHUP/SIGINT)
-
attach_events
(*events, **kwargs)¶ Attach one or more events to the bot instance
-
call_many
(callback, args)¶ callback is run with each arg but run a call per second
-
dcc
¶ return the
DCCManager
-
dcc_accept
(mask, filepath, port, pos)[source]¶ accept a DCC RESUME for an axisting DCC SEND. filepath is the filename to sent. port is the port opened on the server. pos is the expected offset
-
dcc_chat
(mask, host=None, port=None)[source]¶ Open a DCC CHAT whith mask. If host/port are specified then connect to a server. Else create a server
-
dcc_get
(mask, host, port, filepath, filesize=None)[source]¶ DCC GET a file from mask. filepath must be an absolute path with an existing directory. filesize is the expected file size.
-
dcc_send
(mask, filepath)[source]¶ DCC SEND a file to mask. filepath must be an absolute path to existing file
-
detach_events
(*events)¶ Detach one or more events from the bot instance
-
classmethod
from_config
(cfg, **kwargs)¶ return an instance configured with the
cfg
dict
-
ip
¶ return bot’s ip as an
ip_address
object
-
nick
¶ nickname get/set
-
reload
(*modules)¶ Reload one or more plugins
-
run
(forever=True)¶ start the bot
-
server_config
¶ return server configuration (rfc rpl 005):
>>> bot = IrcBot() >>> print(bot.server_config['STATUSMSG']) +@
The real values are only available after the server sent them.
-
IrcConnection¶
-
class
irc3.
IrcConnection
[source]¶ asyncio protocol to handle an irc connection
-
connection_lost
(exc)[source]¶ Called when the connection is lost or closed.
The argument is an exception object or None (the latter meaning a regular EOF is received or the connection was aborted or closed).
-