Multi-line parsing bug fixes

This commit is contained in:
Firepup Sixfifty 2024-05-18 22:52:40 -05:00
parent 385d44c81a
commit 49aa61417a
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA
2 changed files with 3 additions and 3 deletions

4
bot.py
View file

@ -233,9 +233,9 @@ class bot(bare.bot):
if self.queue: if self.queue:
return bytes(self.queue.pop(0)) return bytes(self.queue.pop(0))
data = bytes(self.sock.recv(2048)) data = bytes(self.sock.recv(2048))
while !data.endswith(b"\r\n") while not data.endswith(b"\r\n"):
data += bytes(self.sock.recv(2048)) data += bytes(self.sock.recv(2048))
data.rstrip(b"\r\n") data = bytes(data.strip(b"\r\n"))
if b"\r\n" in data: if b"\r\n" in data:
self.queue.extend(data.split(b"\r\n")) self.queue.extend(data.split(b"\r\n"))
return bytes(self.queue.pop(0)) return bytes(self.queue.pop(0))

View file

@ -10,7 +10,7 @@ ipbl = DNSBLIpChecker()
hsbl = DNSBLDomainChecker() hsbl = DNSBLDomainChecker()
load_dotenv() load_dotenv()
__version__ = "v3.0.13" __version__ = "v3.0.14"
npbase: str = ( npbase: str = (
"\[\x0303last\.fm\x03\] [A-Za-z0-9_[\]{}\\|\-^]{1,$MAX} (is listening|last listened) to: \x02.+ - .*\x02( \([0-9]+ plays\)( \[.*\])?)?" # pyright: ignore [reportInvalidStringEscapeSequence] "\[\x0303last\.fm\x03\] [A-Za-z0-9_[\]{}\\|\-^]{1,$MAX} (is listening|last listened) to: \x02.+ - .*\x02( \([0-9]+ plays\)( \[.*\])?)?" # pyright: ignore [reportInvalidStringEscapeSequence]
) )