forked from Firepup650/FireBot
Implement send and recv on bot class
This commit is contained in:
parent
007f8e0449
commit
ecbc21f907
1 changed files with 8 additions and 2 deletions
10
bot.py
10
bot.py
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue