WebSocket IRC¶
-
class
wsirc.wsirc.WS_IRC(channel, limit)¶ -
channel¶ The IRC channel joined.
-
URL¶ The ws_irc server connected to.
-
run¶ Thread run flag
-
hooks¶ The Hooks object.
-
chat(msg, blocking=False)¶ Send a preformatted chat message to the WebSocket IRC channel
Parameters: - msg – string to chat to the channel
- blocking – whether or not to wait on the limiting semaphore or fail upon not acquiring it
Returns: True if the chat succeeded
-
static
is_symbol(c)¶ Test if a character is a non-alphanum.
Parameters: c – a character Returns: True if the character is a non-alphanum.
-
on_close(ws)¶ Callback for the WebSocketApp close event
Parameters: ws – the WebSocketApp object
-
on_error(ws, error)¶ Callback for the WebSocketApp error event
Parameters: - ws – the WebSocketApp object
- error – the error thrown.
-
on_message(ws, message)¶ Callback for the WebSocketApp message event
Parameters: - ws – the WebSocketApp object
- message – the raw string of the message recieved
-
on_open(ws)¶ Callback for the WebSocketApp open event
Parameters: ws – the WebSocketApp object
-
register_hooks()¶ Register callbacks into the hook object.
Sets a flag to ensure it only runs once.
-
run_loop()¶ The function that runs inside the thread after open
Will run until self.run is False and the WebSocket closes.
-
send(msg, blocking=False, debug=True)¶ Send a message to the WebSocket IRC server
Parameters: - msg – string to send to the server
- blocking – whether or not to wait on the limiting semaphore or fail upon not acquiring it
- debug – whether or not to log the outgoing string at debug level. This is useful for things like not logging the OAuth password.
Returns: True if the send succeeded
-
start()¶ Start the running thread of the SW_IRC object.
The Thread runs forever while self.run is True.
-