I have made a twitchbot, in the console it gives me the “your are in a maze” thing and successfully reads messages from the chat and even pings and pongs but, doesn’t send the messages i tell it to write in chat. here is my bot code
import cfg
import BotFunc
import socket
import re
import time,thread
from time import sleep
def main():
s = socket.socket()
s.connect((cfg.HOST, cfg.PORT))
s.send(“PASS {}\r\n”.format(cfg.PASS).encode(“utf-8”))
s.send(“NICK {}\r\n”.format(cfg.NICK).encode(“utf-8”))
s.send(“JOIN {}\r\n”.format(cfg.CHAN).encode(“utf-8”))
CHAT_MSG = re.compile(r"^:\w+!\w+@\w+\.tmi\.twitch\.tv PRIVMSG #\w+ :")
BotFunc.chat(s, "I LIVE!!!")
thread.start_new_thread(BotFunc.threadFillOPList, ())
while True:
response = s.recv(1024).decode("utf-8")
if response == "PING :tmi.twitch.tv\r\n":
print("Ping")
s.send("PONG :tmi.twitch.tv\r\n".encode("utf-8"))
print("Pong")
else:
username = re.search(r"\w+", response).group(0)
message = CHAT_MSG.sub("", response)
print(response)
if message.strip == "!info": #and BotFunc,isOp(username)
BotFunc.chat(s, "test 1")
BotFunc.chat(s, "test 2")
BotFunc.chat(s, "test 3")
sleep(1)
if name == “main”:
main()
and here is my message sending function
def chat(sock, msg):
sock.send(“PRIVMSG #{} :{}\r\n”.format(cfg.CHAN, msg))
i would greatly appreciate your input and suggestions as to how to fix this, it is important.