]> jfr.im git - erebus.git/blobdiff - modules/example_socket.py
sockets - now working
[erebus.git] / modules / example_socket.py
index 1f6563d5c293f6c4653402d1ebd483dc542b87d9..dc9076787ba4398367e9da6317582ce82458059a 100644 (file)
@@ -25,7 +25,7 @@ modstop = lib.modstop
 # - listen on the socket `sock.listen()`
 # - accept `sock.accept()`
 #
-# Once a connection is accepted, your class is instantiated with the client socket.
+# Once a connection is accepted, your class is instantiated with the client socket. (And the optional third argument you passed to bind_*, or None)
 # - When data comes in on the client socket, your `getdata` method will be called. It should return a list of strings.
 # - For each element in the list returned by `getdata`, `parse` will be called.
 # - When the socket is being closed by the bot (f.e. your module is unloaded), the optional method `closing` will be called.
@@ -36,7 +36,7 @@ modstop = lib.modstop
 
 @lib.bind_tcp('0.0.0.0', 12543)
 class BasicServer(object):
-       def __init__(self, sock):
+       def __init__(self, sock, data):
                self.chan = lib.parent.cfg.get('basic_socket', 'channel', '#')
                self.buffer = b''
                self.sock = sock