Hi, i’m making a twitchbot and i encountered an issue with this code
bot.py
def chat(sock, msg):
sock.send("PRIVMSG #{} :{}".format(cfg.CHAN, msg))
import cfg
import socket
import re
Network Stuff
s = socket.socket()
s.connect((cfg.TWITCH, cfg.PORT))
s.send(“PASS {}\r\n”.format(cfg.OAUTH).encode(“utf-8”))
s.send(“NICK {}\r\n”.format(cfg.BOT).encode(“utf-8”))
s.send(“JOIN {}\r\n”.format(cfg.HOST).encode(“utf-8”))
CHAT_MSG=re.compile(r"^:\w+!\w+@\w+.tmi.twitch.tv PRIVMSG #\w+ :")
while True:
response = s.recv(1024).decode(“utf-8”)
if response == “PING :tmi.twitch.tv\r\n”:
s.send(“PONG :tmi.twitch.tv\r\n”.encode(“utf-8”))
else:
username = re.search(r"\w+", response).group(0)
message = CHAT_MSG.sub("", response)
print(username + ": " + message)
for cfg.info in cfg.info:
if re.match(cfg.info, message):
s.send(s, “,message”)#Command Function Goes Here
break
it says it connects to the channel but doesn’t send/recieve any information, i would really appreciate your input and help