Bot not sending data properly after a set time

I meant spam, like add’s, but not exactly that, sorry for the confusion. Thanks in advance!

I think so…ill paste the code (ill try to comment the code so it is a little less messy)

import socket 
import time
import threading
import logging

TMI_TOKEN="xxxx"
CLIENT_ID="xxx"
BOT_NICK="xxx"
BOT_PREFIX="!"
CHANNEL="xxx"
continue=True
def recving(name,server):

#this function was supposed to read the chat and, in some time, make it so it could read commands and act acordingly
    
    readbuffer = ""
    logging.info("Thread %s: starting", name)
    print(server.recv(1024))

    while continue:
     
        readbuffer=str(server.recv(1024))
        
        if ("PING" in readbuffer):   # the answer to the ping if recieved
            server.send(bytes("PONG :tmi.twitch.tv",'utf-8'))

        else:
            pass  # this used to write comments the chat sent into the pythons command line, but 
                     # was buggy and i just commented it
            """readbuffer=readbuffer.split("PRIVMSG")
            if readbuffer[0].find("!")!=-1:
                name=readbuffer[0].split("!")[1]
                name=name.split("@")[0]
                
                msg=readbuffer[1].split(":")[1]
                print(name+" dijo '"+msg[:-5]+"'") """            
                      
        

        #print(readbuffer[0]+readbuffer[1])
    logging.info("Thread %s: finishing", name)

def spam_each_certaintime(name,server):  # this is the thing
     cont=0
     times=900*3     # to set the freq, (in this case, whenever cont is a multiple of 300 a 
                             # message is sent)
     mensaje3="Somethin"   
     mensaje="Another something"
     mensaje2="The last something "
     while continuar:
        if cont%times==0:
            
            server.send(bytes("PRIVMSG #"+ channel +" :" +mensaje2+ "\r\n",'utf-8'))
        if (cont-(900))%times==0:
    

            server.send(bytes("PRIVMSG #"+ channel +" :" +mensaje+ "\r\n",'utf-8'))
        if (cont-(1800))%veces==0:

            
            server.send(bytes("PRIVMSG #"+ channel +" :" +mensaje3+ "\r\n",'utf-8'))

        if cont%60==0:  # ping sent each 60 seconds
            server.send(bytes("PING :tmi.twitch.tv",'utf-8'))
            print("Send PING")
        else:
            if cont%2==0: # empty message sent to the chat to keep conn alive
                server.send(bytes("PRIVMSG #"+ channel +" :" + "\r\n",'utf-8'))
        cont=cont+1
        print(cont)
        time.sleep(1)
    
    print("stopped")
    
   

    # this down here arent suppose to mather in the error but anyway

stop_threads=False
conn_data=('irc.chat.twitch.tv',6667)
token=TMI_TOKEN
user=BOT_NICK
channel=CHANNEL
prefix=BOT_PREFIX
buffer=""

    if __name__ == "__main__":
    
    # create connection
    server=socket.socket()
    server.connect(conn_data)
    server.send(bytes('PASS '+token+' \r\n','utf-8'))
    server.send(bytes('NICK '+user+' \r\n','utf-8'))
    server.send(bytes('JOIN #'+channel+' \r\n','utf-8'))
    
    print(server)
    
    
    format = "%(asctime)s: %(message)s"
    logging.basicConfig(format=format, level=logging.INFO,datefmt="%H:%M:%S")
   
    # start threads
    logging.info("Main    : before creating thread")
    x = threading.Thread(target=recving, args=(1,server,))
    y = threading.Thread(target=spam_each_certaintime, args=(2,server))
    logging.info("Main    : before running thread")
    x.start()
    y.start()
    logging.info("Main    : wait for the thread to finish")
    # x.join()
    
    
    while 1:
        pass