gkbrk / hackchat Goto Github PK
View Code? Open in Web Editor NEWAn event-driven Python library for hack.chat
License: MIT License
An event-driven Python library for hack.chat
License: MIT License
websocket-client
should be placed in setup.py
and not requirements.txt
for pip
packages as otherwise the dependency isn't automatically installed. I only knew how to make the library work because I found it via the code, but you should probably fix it for others.
Currently I use "on_leave" and "on_join" to modify a list of the current users online, but I do not have a way to create the initial list when my user joins chat.
How to get the message when a user left or join. And other service messages ?
The "hackchat.py" on the pypi.org is not the same as that on GitHub.
Clearly, the one on the pypi.org doesn't have the "whisper" function. It will mislead the users(such as me) who use pip3 install hackchat
just as the README.md said to install the package.
Hope the origin uploader can fix it as soon as possible.
I get this error when I trying to create a chat instance
Traceback (most recent call last):I get this error when I try to use websocket.create_connection:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.5/site-packages/hackchat.py", line 17, in __init__
self.ws = websocket.create_connection("wss://hack.chat/chat-ws")
File "/usr/lib/python3.5/site-packages/websocket/_core.py", line 104, in create_connection
websock.connect(url, **options)
File "/usr/lib/python3.5/site-packages/websocket/_core.py", line 266, in connect
self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options))
File "/usr/lib/python3.5/site-packages/websocket/_http.py", line 69, in connect
sock = _ssl_socket(sock, options.sslopt, hostname)
File "/usr/lib/python3.5/site-packages/websocket/_http.py", line 163, in _ssl_socket
sock = _wrap_sni_socket(sock, sslopt, hostname, check_hostname)
File "/usr/lib/python3.5/site-packages/websocket/_http.py", line 128, in _wrap_sni_socket
context.load_verify_locations(cafile=sslopt.get('ca_certs', None))
TypeError: cafile, capath and cadata cannot be all omitted
It works on my debian machine using python 3.4, but not my arch machine using the most recent python 3.5
I get
hackchat.py", line 18, in __init__ self.send_packet({"cmd": "join", "channel": channel, "nick": nick}) TypeError: send_packet() takes 1 positional argument but 2 were given
when using the library, both from my own bot as well as from running your example directly.
Here is the exact error:
File "/home/t3zla/hackchat/hackbot.py", line 118, in
chat.run_loop()
File "/usr/local/lib/python3.4/dist-packages/hackchat.py", line 38, in run_loop
self.run()
File "/usr/local/lib/python3.4/dist-packages/hackchat.py", line 19, in run
result = json.loads(self.ws.recv())
File "/usr/local/lib/python3.4/dist-packages/websocket/_core.py", line 348, in recv
opcode, data = self.recv_data()
File "/usr/local/lib/python3.4/dist-packages/websocket/_core.py", line 365, in recv_data
opcode, frame = self.recv_data_frame(control_frame)
File "/usr/local/lib/python3.4/dist-packages/websocket/_core.py", line 378, in recv_data_frame
frame = self.recv_frame()
File "/usr/local/lib/python3.4/dist-packages/websocket/_core.py", line 410, in recv_frame
return self.frame_buffer.recv_frame()
File "/usr/local/lib/python3.4/dist-packages/websocket/_abnf.py", line 312, in recv_frame
self.recv_header()
File "/usr/local/lib/python3.4/dist-packages/websocket/_abnf.py", line 261, in recv_header
header = self.recv_strict(2)
File "/usr/local/lib/python3.4/dist-packages/websocket/_abnf.py", line 346, in recv_strict
bytes = self.recv(min(16384, shortage))
File "/usr/local/lib/python3.4/dist-packages/websocket/_core.py", line 479, in _recv
return recv(self.sock, bufsize)
File "/usr/local/lib/python3.4/dist-packages/websocket/_socket.py", line 89, in recv
raise WebSocketConnectionClosedException("Connection is already closed.")
websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.