pytwitcherapi.chat.client.Reactor

class pytwitcherapi.chat.client.Reactor(on_connect=<function __do_nothing>, on_disconnect=<function __do_nothing>)[source]

Bases: irc.client.Reactor

Reactor that can exit the process_forever loop.

The reactor is responsible for managing the connections, and handling the events that come in to the connections.

Simply call Reactor.shutdown() while the reactor is in a loop.

For more information see irc.client.Reactor.

__init__(on_connect=<function __do_nothing>, on_disconnect=<function __do_nothing>)[source]

Initialize a reactor.

Parameters:
  • on_connect – optional callback invoked when a new connection is made.
  • on_disconnect – optional callback invoked when a socket is disconnected.

Methods

__init__([on_connect, on_disconnect]) Initialize a reactor.
add_global_handler(event, handler[, priority]) Adds a global handler function for a specific event type.
dcc([dcctype]) Creates and returns a DCCConnection object.
disconnect_all([message]) Disconnects all connections.
process_data(sockets) Called when there is more data to read on connection sockets.
process_forever([timeout]) Run an infinite loop, processing data from connections.
process_once([timeout]) Process data from connections once.
process_timeout() Called when a timeout notification is due.
remove_global_handler(event, handler) Removes a global handler function.
server() Creates and returns a ServerConnection object.
shutdown() Disconnect all connections and end the loop

Attributes

sockets
process_forever(timeout=0.2)[source]

Run an infinite loop, processing data from connections.

This method repeatedly calls process_once.

Parameters:timeout (float) – Parameter to pass to irc.client.Reactor.process_once()
shutdown()[source]

Disconnect all connections and end the loop

Returns:None
Return type:None
Raises:None