Bot not Send message

Help please. My bot read, but not send messages

import socket
import re
import time
import thread
from time import sleep

HOST = ""
PORT = 6667
NICK = "dmitrygargulin"
PASS = "oauth:xxxxxx"
CHAN = "#mrlehasm"
RATE = (20/30)

oplist = {}

def mess(sock, message):
    #sock.send("PRIVMSG #{} :{}\r\n".format(CHAN, mess).encode("utf-8"))
    sock.send("PRIVMSG #{} :{}".format(CHAN, message))

def main():
    s = socket.socket()
    s.connect((HOST, PORT))
    s.send("PASS {}\r\n".format(PASS).encode("utf-8"))
    s.send("NICK {}\r\n".format(NICK).encode("utf-8"))
    s.send("JOIN {}\r\n".format(CHAN).encode("utf-8"))

    chat_message = re.compile(r"^:w+!\w+@\w+\.tmi\.twitch\.tv PRIVMSG #\w+ :")
    mess(s, "Я родился!")

    response = ""
    while True:
        response = s.recv(1024).decode("utf-8")
        if response == "PING\r\n":
            username ="\w+", response).group(0)
            message = chat_message.sub("", response)
            print(username + ": " + message)
            if message.strip() == "!hello":
                mess(s, "Hi, mister!")

if __name__ == "__main__":

What errors are returned?

Turn on/enabled raw reponse logging and see what you get back when you attempt to send a message

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.