diff options
Diffstat (limited to 'hackchatcustom.py')
-rw-r--r-- | hackchatcustom.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/hackchatcustom.py b/hackchatcustom.py index 67de077..e6ac476 100644 --- a/hackchatcustom.py +++ b/hackchatcustom.py @@ -18,7 +18,7 @@ class HackChat: third for the nickname of the sender of the message. """ - def __init__(self, nick, channel="programming"): + def __init__(self, nick, wsurl="wss://hack.chat/chat-ws", channel="programming"): """Connects to a channel on https://hack.chat. Keyword arguments: nick -- <str>; the nickname to use upon joining the channel @@ -26,6 +26,7 @@ class HackChat: """ self.nick = nick self.channel = channel + self.wsurl = wsurl self.online_users = [] self.on_message = [] self.on_join = [] @@ -58,7 +59,7 @@ class HackChat: if self.stopped: raise ValueError("Can't run a stopped bot.") - self.ws = websocket.create_connection("wss://hack.chat/chat-ws") + self.ws = websocket.create_connection(self.wsurl) self._send_packet({"cmd": "join", "channel": self.channel, "nick": self.nick}) self._recv_thread.start() self._ka_thread.start() |