(ts3conn, msg=None)
return None
Waits for new clients and says hello to them, when they join the server.
Waits for new clients and says hello to them, when they join the server.
Waits for new clients and says hello to them when they join the server .
def hello_bot(ts3conn, msg=None):
    """
    Waits for new clients and says hello to them, when they join the server.
    """
    if msg is None:
        msg = "Hello :)"

    # Register for the event.
    ts3conn.servernotifyregister(event="server")

    while True:
        ts3conn.send_keepalive()

        try:
            # This method blocks, but we must sent the keepalive message at
            # least once in 5 minutes to avoid the sever side idle client
            # disconnect. So we set the timeout parameter simply to 1 minute.
            event = ts3conn.wait_for_event(timeout=60)
        except ts3.query.TS3TimeoutError:
            pass
        else:
            # Greet new clients.
            if event[0]["reasonid"] == "0":
                print("Client '{}' connected.".format(event[0]["client_nickname"]))
                ts3conn.clientpoke(clid=event[0]["clid"], msg=msg)
    return None
def hello_bot ( ts3conn , msg = None ) : if msg is None : msg = "Hello :)" # Register for the event. ts3conn . servernotifyregister ( event = "server" ) while True : ts3conn . send_keepalive ( ) try : # This method blocks, but we must sent the keepalive message at # least once in 5 minutes to avoid the sever side idle client # disconnect. So we set the timeout parameter simply to 1 minute. event = ts3conn . wait_for_event ( timeout = 60 ) except ts3 . query . TS3TimeoutError : pass else : # Greet new clients. if event [ 0 ] [ "reasonid" ] == "0" : print ( "Client '{}' connected." . format ( event [ 0 ] [ "client_nickname" ] ) ) ts3conn . clientpoke ( clid = event [ 0 ] [ "clid" ] , msg = msg ) return None