Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`words`.`protocols`.`irc`.`IRCClient``

class documentation

`class IRCClient(basic.LineReceiver): (source)`

Known subclasses: `twisted.words.im.ircsupport.IRCProto`

View In Hierarchy

Internet Relay Chat client protocol, with sprinkles.

In addition to providing an interface for an IRC client protocol, this class also contains reasonable implementations of many common CTCP methods.

## TODO

- Limit the length of messages sent (because the IRC server probably does).
- Add flood protection/rate limiting for my CTCP replies.
- NickServ cooperation. (a mix-in?)

Method | `__getstate__` | Undocumented
Method | `action` | Called when I see a user perform an ACTION on a channel.
Method | `alterCollidedNick` | Generate an altered version of a nickname that caused a collision in an effort to create an unused related name for subsequent registration.
Method | `away` | Mark this client as away.
Method | `back` | Clear the away status.
Method | `badMessage` | When I get a message that's so broken I can't use it.
Method | `bounce` | Called with information about where the client should reconnect.
Method | `connectionLost` | Called when the connection is shut down.
Method | `connectionMade` | Called when a connection is made.
Method | `created` | Called with creation date information about the server, usually at logon.
Method | `ctcpMakeQuery` | Send one or more `extended messages` as a CTCP query.
Method | `ctcpMakeReply` | Send one or more `extended messages` as a CTCP reply.
Method | `ctcpQuery` | Dispatch method for any CTCP queries received.
Method | `ctcpQuery_ACTION` | Undocumented
Method | `ctcpQuery_CLIENTINFO` | A master index of what CTCP tags this client knows.
Method | `ctcpQuery_DCC` | Initiate a Direct Client Connection
Method | `ctcpQuery_ERRMSG` | Undocumented
Method | `ctcpQuery_FINGER` | Undocumented
Method | `ctcpQuery_PING` | Undocumented
Method | `ctcpQuery_SOURCE` | Undocumented
Method | `ctcpQuery_TIME` | Undocumented
Method | `ctcpQuery_USERINFO` | Undocumented
Method | `ctcpQuery_VERSION` | Undocumented
Method | `ctcpReply` | Dispatch method for any CTCP replies received.
Method | `ctcpReply_PING` | Undocumented
Method | `ctcpUnknownQuery` | Fallback handler for unrecognized CTCP queries.
Method | `ctcpUnknownReply` | Called when a fitting ctcpReply_ method is not found.
Method | `dataReceived` | Protocol.dataReceived. Translates bytes into lines, and calls lineReceived (or rawDataReceived, depending on mode.)
Method | `dcc_ACCEPT` | Undocumented
Method | `dcc_CHAT` | Undocumented
Method | `dcc_RESUME` | Undocumented
Method | `dcc_SEND` | Undocumented
Method | `dccAcceptResume` | Send a DCC ACCEPT response to clients who have requested a resume.
Method | `dccDoAcceptResume` | Called when a client has verified and accepted a DCC resume request made by us. By default it will do nothing.
Method | `dccDoChat` | Undocumented
Method | `dccDoResume` | Called when a client is trying to resume an offered file via DCC send. It should be either replied to with a DCC ACCEPT or ignored (default).
Method | `dccDoSend` | Called when I receive a DCC SEND offer from a client.
Method | `dccResume` | Send a DCC RESUME request to another user.
Method | `dccSend` | This is supposed to send a user a file directly. This generally doesn't work on any client, and this method is included only for backwards compatibility and completeness.
Method | `describe` | Strike a pose.
Method | `getChannelModeParams` | Get channel modes that require parameters for correct parsing.
Method | `getUserModeParams` | Get user modes that require parameters for correct parsing.
Method | `handleCommand` | Determine the function to call for the given command and call it with the given arguments.
Method | `invite` | Attempt to invite user to channel
Method | `irc_ERR_ERRONEUSNICKNAME` | Called when we try to register or change to an illegal nickname.
Method | `irc_ERR_NICKNAMEINUSE` | Called when we try to register or change to a nickname that is already taken.
Method | `irc_ERR_PASSWDMISMATCH` | Called when the login was incorrect.
Method | `irc_JOIN` | Called when a user joins a channel.
Method | `irc_KICK` | Called when a user is kicked from a channel.
Method | `irc_MODE` | Parse a server mode change message.
Method | `irc_NICK` | Called when a user changes their nickname.
Method | `irc_NOTICE` | Called when a user gets a notice.
Method | `irc_PART` | Called when a user leaves a channel.
Method | `irc_PING` | Called when some has pinged us.
Method | `irc_PRIVMSG` | Called when we get a message.
Method | `irc_QUIT` | Called when a user has quit.
Method | `irc_RPL_BOUNCE` | Undocumented
Method | `irc_RPL_CREATED` | Undocumented
Method | `irc_RPL_ENDOFMOTD` | RPL_ENDOFMOTD indicates the end of the message of the day messages. Deliver the accumulated lines to `receivedMOTD`.
Method | `irc_RPL_ISUPPORT` | Undocumented
Method | `irc_RPL_LUSERCHANNELS` | Undocumented
Method | `irc_RPL_LUSERCLIENT` | Undocumented
Method | `irc_RPL_LUSERME` | Undocumented
Method | `irc_RPL_LUSEROP` | Undocumented
Method | `irc_RPL_MOTD` | Undocumented
Method | `irc_RPL_MOTDSTART` | Undocumented
Method | `irc_RPL_MYINFO` | Undocumented
Method | `irc_RPL_NOTOPIC` | Undocumented
Method | `irc_RPL_TOPIC` | Called when the topic for a channel is initially reported or when it subsequently changes.
Method | `irc_RPL_WELCOME` | Called when we have received the welcome from the server.
Method | `irc_RPL_YOURHOST` | Undocumented
Method | `irc_TOPIC` | Someone in the channel set the topic.
Method | `irc_unknown` | Undocumented
Method | `isupport` | Called with various information about what the server supports.
Method | `join` | Join a channel.
Method | `joined` | Called when I finish joining a channel.
Method | `kick` | Attempt to kick a user from a channel.
Method | `kickedFrom` | Called when I am kicked from a channel.
Method | `leave` | Leave a channel.
Method | `left` | Called when I have left a channel.
Method | `lineReceived` | Override this for when each line is received.
Method | `luserChannels` | Called with the number of channels existent on the server.
Method | `luserClient` | Called with information about the number of connections, usually at logon.
Method | `luserMe` | Called with information about the server connected to.
Method | `luserOp` | Called with the number of ops logged on to the server.
Method | `mode` | Change the modes on a user or channel.
Method | `modeChanged` | Called when users or channel's modes are changed.
Method | `msg` | Send a message to a user or channel.
Method | `myInfo` | Called with information about the server, usually at logon.
Method | `nickChanged` | Called when my nick has been changed.
Method | `notice` | Send a notice to a user.
Method | `noticed` | Called when I have a notice from a user to me or a channel.
Method | `ping` | Measure round-trip delay to another IRC client.
Method | `pong` | Called with the results of a CTCP PING query.
Method | `privmsg` | Called when I have a message from a user to me or a channel.
Method | `quirkyMessage` | This is called when I receive a message which is peculiar, but not wholly indecipherable.
Method | `quit` | Disconnect from the server
Method | `receivedMOTD` | I received a message-of-the-day banner from the server.
Method | `register` | Login to the server.
Method | `say` | Send a message to a channel
Method | `sendLine` | Sends a line to the other end of the connection.
Method | `setNick` | Set this client's nickname.
Method | `signedOn` | Called after successfully signing on to the server.
Method | `startHeartbeat` | Start sending PING messages every `IRCClient.heartbeatInterval` seconds to keep the connection to the server alive during periods of no activity.
Method | `stopHeartbeat` | Stop sending PING messages to keep the connection to the server alive.
Method | `topic` | Attempt to set the topic of the given channel, or ask what it is.
Method | `topicUpdated` | In channel, user changed the topic to newTopic.
Method | `userJoined` | Called when I see another user joining a channel.
Method | `userKicked` | Called when I observe someone else being kicked from a channel.
Method | `userLeft` | Called when I see another user leaving a channel.
Method | `userQuit` | Called when I see another user disconnect from the network.
Method | `userRenamed` | A user changed their name from oldname to newname.
Method | `whois` | Retrieve user information about the given nickname.
Method | `yourHost` | Called with daemon information about the server, usually at logon.
Class Variable | `__pychecker__` | Undocumented
Class Variable | `dcc_destdir` | Undocumented
Class Variable | `delimiter` | Undocumented
Class Variable | `performLogin` | Undocumented
Instance Variable | `dcc_sessions` | Undocumented
Instance Variable | `erroneousNickFallback` | Default nickname assigned when an unregistered client triggers an `ERR_ERRONEUSNICKNAME` while trying to register with an illegal nickname.
Instance Variable | `fingerReply` | Sent in reply to a `FINGER` CTCP query. If `None`, no FINGER reply will be sent.
Instance Variable | `heartbeatInterval` | Interval, in seconds, to send PING messages to the server as a form of keepalive, defaults to 120 seconds. Use `None` to disable the heartbeat.
Instance Variable | `hostname` | Host name of the IRC server the client is connected to. Initially the host name is `None` and later is set to the host name from which the RPL_WELCOME message is received.
Instance Variable | `lineRate` | Minimum delay between lines sent to the server. If `None`, no delay will be imposed.
Instance Variable | `motd` | Either `None` or, between receipt of RPL_MOTDSTART and RPL_ENDOFMOTD, a `list` of `str`, each of which is the content of an RPL_MOTD message.
Instance Variable | `nickname` | Nickname the client will use.
Instance Variable | `password` | Password used to log on to the server. May be `None`.
Instance Variable | `realname` | Supplied to the server during login as the "Real name" or "ircname". May be `None`.
Instance Variable | `sourceURL` | CTCP SOURCE reply, a URL where the source code of this client may be found. If `None`, no SOURCE reply will be sent.
Instance Variable | `supported` | Available ISUPPORT features on the server
Instance Variable | `userinfo` | Sent in reply to a `USERINFO` CTCP query. If `None`, no USERINFO reply will be sent. "This is used to transmit a string which is settable by the user (and never should be set by the client)."
Instance Variable | `username` | Supplied to the server during login as the "User name". May be `None`
Instance Variable | `versionEnv` | CTCP VERSION reply, environment the client is running in.
Instance Variable | `versionName` | CTCP VERSION reply, client name. If `None`, no VERSION reply will be sent.
Instance Variable | `versionNum` | CTCP VERSION reply, client version.
Method | `_createHeartbeat` | Create the heartbeat `LoopingCall`.
Method | `_reallySendLine` | Undocumented
Method | `_safeMaximumLineLength` | Estimate a safe maximum line length for the given command.
Method | `_sendHeartbeat` | Send a PING message to the IRC server as a form of keepalive.
Method | `_sendLine` | Undocumented
Constant | `_MAX_PINGRING` | Undocumented
Instance Variable | `_attemptedNick` | The nickname that will try to get registered. It may change if it is illegal or already taken. `nickname` becomes the `_attemptedNick` that is successfully registered.
Instance Variable | `_heartbeat` | Looping call to perform the keepalive by calling `IRCClient._sendHeartbeat` every `heartbeatInterval` seconds, or `None` if there is no heartbeat.
Instance Variable | `_pings` | Undocumented
Instance Variable | `_queue` | Undocumented
Instance Variable | `_queueEmptying` | Undocumented
Instance Variable | `_registered` | Whether or not the user is registered. It becomes True once a welcome has been received from the server.

Inherited from `LineReceiver`:

Method | `clearLineBuffer` | Clear buffered data.
Method | `lineLengthExceeded` | Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way.
Method | `rawDataReceived` | Override this for when raw data is received.
Method | `setLineMode` | Sets the line-mode of this receiver.
Method | `setRawMode` | Sets the raw mode of this receiver. Further data received will be sent to rawDataReceived rather than lineReceived.
Constant | `MAX_LENGTH` | The maximum length of a line to allow (If a sent line is longer than this, the connection is dropped). Default is 16384.
Instance Variable | `line_mode` | Undocumented
Instance Variable | `_buffer` | Undocumented
Instance Variable | `_busyReceiving` | Undocumented

Inherited from `Protocol` (via `LineReceiver`):

Method | `logPrefix` | Return a prefix matching the class name, to identify log messages related to this protocol instance.
Class Variable | `factory` | Undocumented

Inherited from `BaseProtocol` (via `LineReceiver`, `Protocol`):

Method | `makeConnection` | Make a connection to a transport and a server.
Instance Variable | `connected` | Undocumented
Instance Variable | `transport` | Undocumented

Inherited from `_PauseableMixin` (via `LineReceiver`, `Protocol`, `BaseProtocol`):

Method | `pauseProducing` | Undocumented
Method | `resumeProducing` | Undocumented
Method | `stopProducing` | Undocumented
Instance Variable | `paused` | Undocumented

def __getstate__(self): (source)

Undocumented

def action(self, user, channel, data): (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Called when I see a user perform an ACTION on a channel.

def alterCollidedNick(self, nickname): (source)

Generate an altered version of a nickname that caused a collision in an effort to create an unused related name for subsequent registration.

Parameters
nickname:`str` | The nickname a user is attempting to register.
Returns
`str` | A string that is in some way different from the nickname.

def away(self, message=''): (source)

Mark this client as away.

Parameters
message:`str` | If specified, the away message.

def back(self): (source)

Clear the away status.

def badMessage(self, line, excType, excValue, tb): (source)

When I get a message that's so broken I can't use it.

Parameters
line:`bytes` | The indecipherable message.
excType:`type` | The exception type of the exception raised by the message.
excValue:`BaseException` | The exception parameter of excType or its associated value(the second argument to `raise`).
tb:`traceback` | The Traceback as a traceback object.

def bounce(self, info): (source)

Called with information about where the client should reconnect.

Parameters
info:`str` | A plaintext description of the address that should be connected to.

def connectionLost(self, reason): (source)
from `twisted.internet.interfaces.IProtocol`
overrides `twisted.internet.protocol.Protocol.connectionLost`

Called when the connection is shut down.

Clear any circular references here, and any external references to this Protocol. The connection has been closed.

Parameters
reason:`twisted.python.failure.Failure` | Undocumented

def connectionMade(self): (source)
from `twisted.internet.interfaces.IProtocol`
overrides `twisted.internet.protocol.BaseProtocol.connectionMade`
overridden in `twisted.words.im.ircsupport.IRCProto`

Called when a connection is made.

This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.

def created(self, when): (source)

Called with creation date information about the server, usually at logon.

Parameters
when:`str` | A string describing when the server was created, probably.

def ctcpMakeQuery(self, user, messages): (source)

Send one or more `extended messages` as a CTCP query.

Parameters
user | Undocumented
messages:a list of extended messages. An extended message is a (tag, data) tuple, where 'data' may be `None`. | Undocumented

def ctcpMakeReply(self, user, messages): (source)

Send one or more `extended messages` as a CTCP reply.

Parameters
user | Undocumented
messages:a list of extended messages. An extended message is a (tag, data) tuple, where 'data' may be `None`. | Undocumented

def ctcpQuery(self, user, channel, messages): (source)

Dispatch method for any CTCP queries received.

Duplicated CTCP queries are ignored and no dispatch is made. Unrecognized CTCP queries invoke `IRCClient.ctcpUnknownQuery`.

def ctcpQuery_ACTION(self, user, channel, data): (source)

Undocumented

def ctcpQuery_CLIENTINFO(self, user, channel, data): (source)

A master index of what CTCP tags this client knows.

If no arguments are provided, respond with a list of known tags, sorted in alphabetical order. If an argument is provided, provide human-readable help on the usage of that tag.

def ctcpQuery_DCC(self, user, channel, data): (source)

Initiate a Direct Client Connection

Parameters
user:`bytes` | The hostmask of the user/client.
channel:`bytes` | The name of the IRC channel.
data:`bytes` | The DCC request message.

def ctcpQuery_ERRMSG(self, user, channel, data): (source)

Undocumented

def ctcpQuery_FINGER(self, user, channel, data): (source)

Undocumented

def ctcpQuery_PING(self, user, channel, data): (source)

Undocumented

def ctcpQuery_SOURCE(self, user, channel, data): (source)

Undocumented

def ctcpQuery_TIME(self, user, channel, data): (source)

Undocumented

def ctcpQuery_USERINFO(self, user, channel, data): (source)

Undocumented

def ctcpQuery_VERSION(self, user, channel, data): (source)

Undocumented

def ctcpReply(self, user, channel, messages): (source)

Dispatch method for any CTCP replies received.

def ctcpReply_PING(self, user, channel, data): (source)

Undocumented

def ctcpUnknownQuery(self, user, channel, tag, data): (source)

Fallback handler for unrecognized CTCP queries.

No CTCP ERRMSG reply is made to remove a potential denial of service avenue.

def ctcpUnknownReply(self, user, channel, tag, data): (source)

Called when a fitting ctcpReply_ method is not found.

Parameters
user:`bytes` | The hostmask of the user.
channel:`bytes` | The name of the IRC channel.
tag:`bytes` | The CTCP request tag for which no fitting method is found.
data:`bytes` | The CTCP message.

def dataReceived(self, data): (source)
from `twisted.internet.interfaces.IProtocol`
overrides `twisted.protocols.basic.LineReceiver.dataReceived`

Protocol.dataReceived. Translates bytes into lines, and calls lineReceived (or rawDataReceived, depending on mode.)

def dcc_ACCEPT(self, user, channel, data): (source)

Undocumented

def dcc_CHAT(self, user, channel, data): (source)

Undocumented

def dcc_RESUME(self, user, channel, data): (source)

Undocumented

def dcc_SEND(self, user, channel, data): (source)

Undocumented

def dccAcceptResume(self, user, fileName, port, resumePos): (source)

Send a DCC ACCEPT response to clients who have requested a resume.

def dccDoAcceptResume(self, user, file, port, resumePos): (source)

Called when a client has verified and accepted a DCC resume request made by us. By default it will do nothing.

Parameters
user:`bytes` | The hostmask of the user who has accepted the DCC resume request.
file:`bytes` | The name of the file to resume the transfer of.
port:`int` | An integer representing the port of the accepting user.
resumePos:`int` | The position in the file from where the transfer should resume.

def dccDoChat(self, user, channel, address, port, data): (source)

Undocumented

def dccDoResume(self, user, file, port, resumePos): (source)

Called when a client is trying to resume an offered file via DCC send. It should be either replied to with a DCC ACCEPT or ignored (default).

Parameters
user:`bytes` | The hostmask of the user who wants to resume the transfer of a file previously offered via DCC send.
file:`bytes` | The name of the file to resume the transfer of.
port:`int` | An integer representing the port of the requesting user.
resumePos:`int` | The position in the file from where the transfer should resume.

def dccDoSend(self, user, address, port, fileName, size, data): (source)

Called when I receive a DCC SEND offer from a client.

By default, I do nothing here.

Parameters
user:`bytes` | The hostmask of the requesting user.
address:`bytes` | The IP address of the requesting user.
port:`int` | An integer representing the port of the requesting user.
fileName:`bytes` | The name of the file to be transferred.
size:`int` | The size of the file to be transferred, which may be `-1` if the size of the file was not specified in the DCC SEND request.
data:`list` | A 3-list of [fileName, address, port].

def dccResume(self, user, fileName, port, resumePos): (source)

Send a DCC RESUME request to another user.

def dccSend(self, user, file): (source)

This is supposed to send a user a file directly. This generally doesn't work on any client, and this method is included only for backwards compatibility and completeness.

Parameters
user | `str` representing the user
file | an open file (unknown, since this is not implemented)

def describe(self, channel, action): (source)

Strike a pose.

Parameters
channel:`str` | The name of the channel to have an action on. If it has no prefix, it is sent to the user of that name.
action:`str` | The action to preform.
Present Since
9.0

def getChannelModeParams(self): (source)

Get channel modes that require parameters for correct parsing.

Returns
`[str, str]` | `[add, remove]`

def getUserModeParams(self): (source)

Get user modes that require parameters for correct parsing.

Returns
`[str, str]` | `[add, remove]`

def handleCommand(self, command, prefix, params): (source)

Determine the function to call for the given command and call it with the given arguments.

Parameters
command:`bytes` | The IRC command to determine the function for.
prefix:`bytes` | The prefix of the IRC message (as returned by `parsemsg`).
params:`list` | A list of parameters to call the function with.

def invite(self, user, channel): (source)

Attempt to invite user to channel

Parameters
user:`str` | The user to invite
channel:`str` | The channel to invite the user too
Present Since
11.0

def irc_ERR_ERRONEUSNICKNAME(self, prefix, params): (source)

Called when we try to register or change to an illegal nickname.

The server should send this reply when the nickname contains any disallowed characters. The bot will stall, waiting for RPL_WELCOME, if we don't handle this during sign-on.

Note
The method uses the spelling erroneus, as it appears in the RFC, section 6.1.

def irc_ERR_NICKNAMEINUSE(self, prefix, params): (source)

Called when we try to register or change to a nickname that is already taken.

def irc_ERR_PASSWDMISMATCH(self, prefix, params): (source)

Called when the login was incorrect.

def irc_JOIN(self, prefix, params): (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Called when a user joins a channel.

def irc_KICK(self, prefix, params): (source)

Called when a user is kicked from a channel.

def irc_MODE(self, user, params): (source)

Parse a server mode change message.

def irc_NICK(self, prefix, params): (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Called when a user changes their nickname.

def irc_NOTICE(self, prefix, params): (source)

Called when a user gets a notice.

def irc_PART(self, prefix, params): (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Called when a user leaves a channel.

def irc_PING(self, prefix, params): (source)

Called when some has pinged us.

def irc_PRIVMSG(self, prefix, params): (source)

Called when we get a message.

def irc_QUIT(self, prefix, params): (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Called when a user has quit.

def irc_RPL_BOUNCE(self, prefix, params): (source)

Undocumented

def irc_RPL_CREATED(self, prefix, params): (source)

Undocumented

def irc_RPL_ENDOFMOTD(self, prefix, params): (source)

RPL_ENDOFMOTD indicates the end of the message of the day messages. Deliver the accumulated lines to `receivedMOTD`.

def irc_RPL_ISUPPORT(self, prefix, params): (source)

Undocumented

def irc_RPL_LUSERCHANNELS(self, prefix, params): (source)

Undocumented

def irc_RPL_LUSERCLIENT(self, prefix, params): (source)

Undocumented

def irc_RPL_LUSERME(self, prefix, params): (source)

Undocumented

def irc_RPL_LUSEROP(self, prefix, params): (source)

Undocumented

def irc_RPL_MOTD(self, prefix, params): (source)

Undocumented

def irc_RPL_MOTDSTART(self, prefix, params): (source)

Undocumented

def irc_RPL_MYINFO(self, prefix, params): (source)

Undocumented

def irc_RPL_NOTOPIC(self, prefix, params): (source)

Undocumented

def irc_RPL_TOPIC(self, prefix, params): (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Called when the topic for a channel is initially reported or when it subsequently changes.

def irc_RPL_WELCOME(self, prefix, params): (source)

Called when we have received the welcome from the server.

def irc_RPL_YOURHOST(self, prefix, params): (source)

Undocumented

def irc_TOPIC(self, prefix, params): (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Someone in the channel set the topic.

def irc_unknown(self, prefix, command, params): (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Undocumented

def isupport(self, options): (source)

Called with various information about what the server supports.

Parameters
options:`list` of `str` | Descriptions of features or limits of the server, possibly in the form "NAME=VALUE".

def join(self, channel, key=None): (source)

Join a channel.

Parameters
channel:`str` | The name of the channel to join. If it has no prefix, `'#'` will be prepended to it.
key:`str` | If specified, the key used to join the channel.

def joined(self, channel): (source)

Called when I finish joining a channel.

channel has the starting character (`'#'`, `'&'`, `'!'`, or `'+'`) intact.

def kick(self, channel, user, reason=None): (source)

Attempt to kick a user from a channel.

Parameters
channel:`str` | The name of the channel to kick the user from. If it has no prefix, `'#'` will be prepended to it.
user:`str` | The nick of the user to kick.
reason:`str` | If given, the reason for kicking the user.

def kickedFrom(self, channel, kicker, message): (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Called when I am kicked from a channel.

def leave(self, channel, reason=None): (source)

Leave a channel.

Parameters
channel:`str` | The name of the channel to leave. If it has no prefix, `'#'` will be prepended to it.
reason:`str` | If given, the reason for leaving.

def left(self, channel): (source)

Called when I have left a channel.

channel has the starting character (`'#'`, `'&'`, `'!'`, or `'+'`) intact.

def lineReceived(self, line): (source)
overrides `twisted.protocols.basic.LineReceiver.lineReceived`

Override this for when each line is received.

Parameters
line:`bytes` | The line which was received with the delimiter removed.

def luserChannels(self, channels): (source)

Called with the number of channels existent on the server.

Parameters
channels:`int` | Undocumented

def luserClient(self, info): (source)

Called with information about the number of connections, usually at logon.

Parameters
info:`str` | A description of the number of clients and servers connected to the network, probably.

def luserMe(self, info): (source)

Called with information about the server connected to.

Parameters
info:`str` | A plaintext string describing the number of users and servers connected to this server.

def luserOp(self, ops): (source)

Called with the number of ops logged on to the server.

Parameters
ops:`int` | Undocumented

def mode(self, chan, set, modes, limit=None, user=None, mask=None): (source)

Change the modes on a user or channel.

The `limit`, `user`, and `mask` parameters are mutually exclusive.

Parameters
chan:`str` | The name of the channel to operate on.
set:`bool` | True to give the user or channel permissions and False to remove them.
modes:`str` | The mode flags to set on the user or channel.
limit:`int` | In conjunction with the `'l'` mode flag, limits the number of users on the channel.
user:`str` | The user to change the mode on.
mask:`str` | In conjunction with the `'b'` mode flag, sets a mask of users to be banned from the channel.

def modeChanged(self, user, channel, set, modes, args): (source)

Called when users or channel's modes are changed.

Parameters
user:`str` | The user and hostmask which instigated this change.
channel:`str` | The channel where the modes are changed. If args is empty the channel for which the modes are changing. If the changes are at server level it could be equal to `user`.
set:`bool` or `int` | True if the mode(s) is being added, False if it is being removed. If some modes are added and others removed at the same time this function will be called twice, the first time with all the added modes, the second with the removed ones. (To change this behaviour override the irc_MODE method)
modes:`str` | The mode or modes which are being changed.
args:`tuple` | Any additional information required for the mode change.

def msg(self, user, message, length=None): (source)

Send a message to a user or channel.

The message will be split into multiple commands to the server if:

- The message contains any newline characters
- Any span between newline characters is longer than the given line-length.

Parameters
user:`str` | Username or channel name to which to direct the message.
message:`str` | Text to send.
length:`int` | Maximum number of octets to send in a single command, including the IRC protocol framing. If `None` is given then `IRCClient._safeMaximumLineLength` is used to determine a value.

def myInfo(self, servername, version, umodes, cmodes): (source)

Called with information about the server, usually at logon.

Parameters
servername:`str` | The hostname of this server.
version:`str` | A description of what software this server runs.
umodes:`str` | All the available user modes.
cmodes:`str` | All the available channel modes.

def nickChanged(self, nick): (source)

Called when my nick has been changed.

def notice(self, user, message): (source)

Send a notice to a user.

Notices are like normal message, but should never get automated replies.

Parameters
user:`str` | The user to send a notice to.
message:`str` | The contents of the notice to send.

def noticed(self, user, channel, message): (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Called when I have a notice from a user to me or a channel.

If the client makes any automated replies, it must not do so in response to a NOTICE message, per the RFC:

        The difference between NOTICE and PRIVMSG is that
        automatic replies MUST NEVER be sent in response to a
        NOTICE message. [...] The object of this rule is to avoid
        loops between clients automatically sending something in
        response to something it received.

def ping(self, user, text=None): (source)

Measure round-trip delay to another IRC client.

def pong(self, user, secs): (source)

Called with the results of a CTCP PING query.

def privmsg(self, user, channel, message): (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Called when I have a message from a user to me or a channel.

def quirkyMessage(self, s): (source)

This is called when I receive a message which is peculiar, but not wholly indecipherable.

Parameters
s:`bytes` | The peculiar message.

def quit(self, message=''): (source)

Disconnect from the server

Parameters
message:`str` | If specified, the message to give when quitting the server.

def receivedMOTD(self, motd): (source)

I received a message-of-the-day banner from the server.

motd is a list of strings, where each string was sent as a separate message from the server. To display, you might want to use:

        '\n'.join(motd)

to get a nicely formatted string.

def register(self, nickname, hostname='foo', servername='bar'): (source)

Login to the server.

Parameters
nickname:`str` | The nickname to register.
hostname:`str` | If specified, the hostname to logon as.
servername:`str` | If specified, the servername to logon as.

def say(self, channel, message, length=None): (source)

Send a message to a channel

Parameters
channel:`str` | The channel to say the message on. If it has no prefix, `'#'` will be prepended to it.
message:`str` | The message to say.
length:`int` | The maximum number of octets to send at a time. This has the effect of turning a single call to `msg()` into multiple commands to the server. This is useful when long messages may be sent that would otherwise cause the server to kick us off or silently truncate the text we are sending. If None is passed, the entire message is always send in one command.

def sendLine(self, line): (source)
overrides `twisted.protocols.basic.LineReceiver.sendLine`

Sends a line to the other end of the connection.

Parameters
line:`bytes` | The line to send, not including the delimiter.

def setNick(self, nickname): (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Set this client's nickname.

Parameters
nickname:`str` | The nickname to change to.

def signedOn(self): (source)

Called after successfully signing on to the server.

def startHeartbeat(self): (source)

Start sending PING messages every `IRCClient.heartbeatInterval` seconds to keep the connection to the server alive during periods of no activity.

Present Since
11.1

def stopHeartbeat(self): (source)

Stop sending PING messages to keep the connection to the server alive.

Present Since
11.1

def topic(self, channel, topic=None): (source)

Attempt to set the topic of the given channel, or ask what it is.

If topic is None, then I sent a topic query instead of trying to set the topic. The server should respond with a TOPIC message containing the current topic of the given channel.

Parameters
channel:`str` | The name of the channel to change the topic on. If it has no prefix, `'#'` will be prepended to it.
topic:`str` | If specified, what to set the topic to.

def topicUpdated(self, user, channel, newTopic): (source)

In channel, user changed the topic to newTopic.

Also called when first joining a channel.

def userJoined(self, user, channel): (source)

Called when I see another user joining a channel.

def userKicked(self, kickee, channel, kicker, message): (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Called when I observe someone else being kicked from a channel.

def userLeft(self, user, channel): (source)

Called when I see another user leaving a channel.

def userQuit(self, user, quitMessage): (source)

Called when I see another user disconnect from the network.

def userRenamed(self, oldname, newname): (source)

A user changed their name from oldname to newname.

def whois(self, nickname, server=None): (source)

Retrieve user information about the given nickname.

Parameters
nickname:`str` | The nickname about which to retrieve information.
server | Undocumented
Present Since
8.2

def yourHost(self, info): (source)

Called with daemon information about the server, usually at logon.

Parameters
info:`str` | A string describing what software the server is running, probably.

__pychecker__: `str` = (source)

Undocumented

dcc_destdir: `str` = (source)

Undocumented

delimiter: `bytes` = (source)
overrides `twisted.protocols.basic.LineReceiver.delimiter`

Undocumented

performLogin: `int` = (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Undocumented

dcc_sessions: `list` = (source)

Undocumented

erroneousNickFallback: `str` = (source)

Default nickname assigned when an unregistered client triggers an `ERR_ERRONEUSNICKNAME` while trying to register with an illegal nickname.

fingerReply: Callable or String = (source)

Sent in reply to a `FINGER` CTCP query. If `None`, no FINGER reply will be sent.

heartbeatInterval: `float` = (source)

Interval, in seconds, to send PING messages to the server as a form of keepalive, defaults to 120 seconds. Use `None` to disable the heartbeat.

hostname: `str` = (source)

Host name of the IRC server the client is connected to. Initially the host name is `None` and later is set to the host name from which the RPL_WELCOME message is received.

lineRate: Number of Seconds. = (source)

Minimum delay between lines sent to the server. If `None`, no delay will be imposed.

motd = (source)

Either `None` or, between receipt of RPL_MOTDSTART and RPL_ENDOFMOTD, a `list` of `str`, each of which is the content of an RPL_MOTD message.

nickname = (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Nickname the client will use.

password = (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Password used to log on to the server. May be `None`.

realname = (source)
overridden in `twisted.words.im.ircsupport.IRCProto`

Supplied to the server during login as the "Real name" or "ircname". May be `None`.

sourceURL: `str` = (source)

CTCP SOURCE reply, a URL where the source code of this client may be found. If `None`, no SOURCE reply will be sent.

supported: `ServerSupportedFeatures` = (source)

Available ISUPPORT features on the server

userinfo = (source)

Sent in reply to a `USERINFO` CTCP query. If `None`, no USERINFO reply will be sent. "This is used to transmit a string which is settable by the user (and never should be set by the client)."

username = (source)

Supplied to the server during login as the "User name". May be `None`

versionEnv: `str`, or None. = (source)

CTCP VERSION reply, environment the client is running in.

versionName: `str`, or None. = (source)

CTCP VERSION reply, client name. If `None`, no VERSION reply will be sent.

versionNum: `str`, or None. = (source)

CTCP VERSION reply, client version.

def _createHeartbeat(self): (source)

Create the heartbeat `LoopingCall`.

def _reallySendLine(self, line): (source)

Undocumented

def _safeMaximumLineLength(self, command): (source)

Estimate a safe maximum line length for the given command.

This is done by assuming the maximum values for nickname length, realname and hostname combined with the command that needs to be sent and some guessing. A theoretical maximum value is used because it is possible that our nickname, username or hostname changes (on the server side) while the length is still being calculated.

def _sendHeartbeat(self): (source)

Send a PING message to the IRC server as a form of keepalive.

def _sendLine(self): (source)

Undocumented

_MAX_PINGRING: `int` = (source)

Undocumented

Value

    12

_attemptedNick: `str` = (source)

The nickname that will try to get registered. It may change if it is illegal or already taken. `nickname` becomes the `_attemptedNick` that is successfully registered.

_heartbeat: `task.LoopingCall` = (source)

Looping call to perform the keepalive by calling `IRCClient._sendHeartbeat` every `heartbeatInterval` seconds, or `None` if there is no heartbeat.

_pings: `dict` = (source)

Undocumented

_queue: `list` = (source)

Undocumented

_queueEmptying = (source)

Undocumented

_registered: `bool` = (source)

Whether or not the user is registered. It becomes True once a welcome has been received from the server.