|
|
|
@ -2,7 +2,6 @@ import socket
|
|
|
|
|
import yaml
|
|
|
|
|
from random import randint
|
|
|
|
|
from sys import exit
|
|
|
|
|
from time import sleep
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Util:
|
|
|
|
@ -49,7 +48,6 @@ class IRC:
|
|
|
|
|
for c in self.channels:
|
|
|
|
|
# Pass in a context dict for handlers
|
|
|
|
|
listen_hook({"msg": self.msg, "listen_chan": c})
|
|
|
|
|
sleep(1)
|
|
|
|
|
|
|
|
|
|
def connect(self, server, bot_nick):
|
|
|
|
|
"""Connect to the server and sends user/nick information."""
|
|
|
|
@ -72,7 +70,8 @@ class IRC:
|
|
|
|
|
|
|
|
|
|
def keepalive(self, line):
|
|
|
|
|
"""Stay connected to a server by responding to server pings."""
|
|
|
|
|
if resp != []:
|
|
|
|
|
resp = line
|
|
|
|
|
if resp != "":
|
|
|
|
|
resp = line.split(" ", 1)[1]
|
|
|
|
|
if ("PING " + resp) in line:
|
|
|
|
|
self.send("PONG", resp)
|
|
|
|
@ -102,7 +101,7 @@ class IRC:
|
|
|
|
|
|
|
|
|
|
def receive(self):
|
|
|
|
|
"""Get messages from the connected socket."""
|
|
|
|
|
data = self.sock.recv(2040).decode("utf-8").strip("\r\n")
|
|
|
|
|
data = self.sock.recv(2048).decode("utf-8").strip("\r\n")
|
|
|
|
|
if self.debug:
|
|
|
|
|
print("[debug][recv] " + data)
|
|
|
|
|
return data
|
|
|
|
|