IRC

Manage the IRC layer.

Classes

class irc_api.irc.IRC(host: str, port: int)

Manage connection to an IRC server, authentication and callbacks.

Attributes

connectedbool, public

If the bot is connected to an IRC server or not.

socketssl.SSLSocket, private

The IRC’s socket.

inboxQueue, private

Queue of the incomming messages.

handler : Thread, private

Methods

__init__(host: str, port: int)

Initialize an IRC wrapper.

Parameters

hoststr

The adress of the IRC server.

portint

The port of the IRC server.

connection(nick: str, auth: tuple = ())

Start the IRC layer. Manage authentication as well.

Parameters

nickstr

The nickname used.

authtuple, optionnal

The tuple (username, password) for a SASL authentication. Leave empty if no SASL auth is required.

join(channel: str)

Join a channel.

Parameters

channelstr

The name of the channel to join.

receive()

Receive a private message.

Returns

msgMessage

The incoming processed private message.

send(raw: str)

Wrap and encode raw message to send.

Parameters

rawstr

The raw message to send.

waitfor(condition)

Wait for a raw message that matches the condition.

Parameters

conditionfunction

condition is a function that must taking a raw message in parameter and returns a boolean.

Returns

msgstr

The last message received that doesn’t match the condition.