forked from Firepup650/FireBot
SAFELY decode messages. (Silently ignore invalid bytes)
This commit is contained in:
parent
d6932805d6
commit
b4f8450e7d
1 changed files with 3 additions and 3 deletions
6
bot.py
6
bot.py
|
@ -50,7 +50,7 @@ class bot(bare.bot):
|
||||||
self.send(f"NICK {self.nick}\n")
|
self.send(f"NICK {self.nick}\n")
|
||||||
ircmsg = ""
|
ircmsg = ""
|
||||||
while True:
|
while True:
|
||||||
ircmsg = self.recv().decode()
|
ircmsg = self.recv().safe_decode()
|
||||||
if ircmsg != "":
|
if ircmsg != "":
|
||||||
code = 0
|
code = 0
|
||||||
try:
|
try:
|
||||||
|
@ -100,7 +100,7 @@ class bot(bare.bot):
|
||||||
return
|
return
|
||||||
self.send(f"JOIN {chan}\n")
|
self.send(f"JOIN {chan}\n")
|
||||||
while True:
|
while True:
|
||||||
ircmsg = self.recv().decode()
|
ircmsg = self.recv().safe_decode()
|
||||||
if ircmsg != "":
|
if ircmsg != "":
|
||||||
code = 0
|
code = 0
|
||||||
try:
|
try:
|
||||||
|
@ -203,7 +203,7 @@ class bot(bare.bot):
|
||||||
self.join(chan, "null", False)
|
self.join(chan, "null", False)
|
||||||
while 1:
|
while 1:
|
||||||
raw = self.recv()
|
raw = self.recv()
|
||||||
ircmsg = raw.decode()
|
ircmsg = raw.safe_decode()
|
||||||
if ircmsg == "":
|
if ircmsg == "":
|
||||||
self.exit("Probably a netsplit")
|
self.exit("Probably a netsplit")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue