ib3 package¶
Module contents¶
-
class
ib3.
Bot
(*args, **kwargs)[source]¶ Bases:
irc.bot.SingleServerIRCBot
Basic IRC bot.
Simple subclass of
irc.bot.SingleServerIRCBot
that sets up lenient UTF-8 encoding handling for inbound messages. This is a nice base to start from when adding other IB3 mixins.
Submodules¶
ib3.auth module¶
-
class
ib3.auth.
AbstractAuth
(server_list, nickname, realname, ident_password, channels=None, username=None, **kwargs)[source]¶ Bases:
ib3.mixins.JoinChannels
Base class for authentication mixins.
-
__init__
(server_list, nickname, realname, ident_password, channels=None, username=None, **kwargs)[source]¶ Parameters: - server_list – List of servers the bot will use.
- nickname – The bot’s nickname
- realname – The bot’s realname
- ident_password – The bot’s password
- channels – List of channels to join after authenticating
- username – IRC username (default: nickname)
-
-
class
ib3.auth.
NickServ
(*args, **kwargs)[source]¶ Bases:
ib3.auth.AbstractAuth
Authenticate with NickServ before joining channels.
-
__init__
(*args, **kwargs)[source]¶ Parameters: - server_list – List of servers the bot will use.
- nickname – The bot’s nickname
- realname – The bot’s realname
- ident_password – The bot’s password
- channels – List of channels to join after authenticating
- username – IRC username (default: nickname)
-
_handle_privnotice
(conn, event)[source]¶ Handle NOTICE sent directly to user.
Check for messages from NickServ requesting auth, warning of password failures, and acknowledging successful auth.
-
-
class
ib3.auth.
SASL
(*args, **kwargs)[source]¶ Bases:
ib3.auth.AbstractAuth
Authenticate using SASL before joining channels.
ib3.connection module¶
ib3.mixins module¶
-
class
ib3.mixins.
DisconnectOnError
(*args, **kwargs)[source]¶ Bases:
object
Handle ERROR message by logging and disconnecting.
-
class
ib3.mixins.
PingServer
(max_pings=2, ping_interval=300, *args, **kwargs)[source]¶ Bases:
object
Add checks for connection liveness using PING commands.
ib3.nick module¶
-
class
ib3.nick.
Ghost
(server_list, nickname, realname, altnick=None, *args, **kwargs)[source]¶ Bases:
ib3.nick.NicknameInUse
GHOST disconnects an old user session, or somebody attempting to use your nickname without authorization.
This mixin assumes that you are also using a mixin from
ib3.auth
or another means to authenticate your IRC account.
-
class
ib3.nick.
NicknameInUse
(server_list, nickname, realname, altnick=None, *args, **kwargs)[source]¶ Bases:
object
Handle ERR_NICKNAMEINUSE messages by changing to an alternate nick.
-
__init__
(server_list, nickname, realname, altnick=None, *args, **kwargs)[source]¶ Parameters: - server_list – List of servers the bot will use.
- nickname – The bot’s nickname
- realname – The bot’s realname
- altnick – Alternate nickname if primary nick is taken
-
_handle_nicknameinuse
(conn, event)[source]¶ Handle ERR_NICKNAMEINUSE message.
If failed nick matches our desired nick, switch to secondary nick, and schedule an attempt to reclaim our primary nick.
If failed nick matches our secondary nick, die.
-
-
class
ib3.nick.
Regain
(server_list, nickname, realname, altnick=None, *args, **kwargs)[source]¶ Bases:
ib3.nick.NicknameInUse
REGAIN disconnects an old user session, or somebody attempting to use your nickname without authorization, then changes your nickname to the given nickname. This may not work, disconnecting you, if the target client reconnects automatically.
This mixin assumes that you are also using a mixin from
ib3.auth
or another means to authenticate your IRC account.