Implement send and recv on bot class

This commit is contained in:
Firepup Sixfifty 2023-11-05 16:26:50 -06:00
parent 007f8e0449
commit ecbc21f907
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA

10
bot.py
View file

@ -30,10 +30,16 @@ class bot:
log(f"Start init for {server}", self.server) log(f"Start init for {server}", self.server)
def send(self, command: str) -> int: def send(self, command: str) -> int:
pass return ircsock.send(bytes(command))
def recv(self) -> bytes: def recv(self) -> bytes:
pass if self.queue:
return bytes(self.queue.pop(0))
data = bytes(self.socket.recv(2048).strip(b"\r\n"))
if b"\r\n" in data:
self.queue.extend(data.split(b"\r\n"))
return bytes(self.queue.pop(0))
return data
def log(self, message: object) -> None: def log(self, message: object) -> None:
log(message, self.server) log(message, self.server)