(ts3conn, duration=10, relax_time=0.5)
return None
Moves all clients randomly in other channels for *duration* seconds.
    After the whirpool event, all clients will be in the same channel as
    before. Between the whirlpool cycles, the programm will sleep for
    *relax_time* seconds.
Moves all clients randomly in other channels for *duration* seconds.
    After the whirpool event, all clients will be in the same channel as
    before. Between the whirlpool cycles, the programm will sleep for
    *relax_time* seconds.
Moves all clients randomly in other channels for * duration * seconds . After the whirpool event all clients will be in the same channel as before . Between the whirlpool cycles the programm will sleep for * relax_time * seconds .
def whirlpool(ts3conn, duration=10, relax_time=0.5):
    """
    Moves all clients randomly in other channels for *duration* seconds.
    After the whirpool event, all clients will be in the same channel as
    before. Between the whirlpool cycles, the programm will sleep for
    *relax_time* seconds.
    """
    # Countdown till whirlpool
    for i in range(5, 0, -1):
        ts3conn.sendtextmessage(
            targetmode=ts3.definitions.TextMessageTargetMode.SERVER,
            target=0, msg="Whirpool in {}s".format(i))
        time.sleep(1)

    # Fetch the clientlist and the channellist.
    clientlist = ts3conn.clientlist()
    channellist = ts3conn.channellist()

    # Ignore query clients
    clientlist = [client for client in clientlist \
                  if client["client_type"] != "1"]

    # Whirpool with one channel or no users is boring.
    if len(channellist) == 1 or not clientlist:
        return None

    # We need this try-final construct to make sure, that all
    # clients will be in the same channel at the end of the
    # whirlpool as to the beginning.
    try:
        end_time = time.time() + duration
        while end_time > time.time():
            for client in clientlist:
                clid = client["clid"]
                cid = random.choice(channellist)["cid"]
                try:
                    ts3conn.clientmove(clid=clid, cid=cid)
                except ts3.query.TS3QueryError as err:
                    # Only ignore 'already member of channel error'
                    if err.resp.error["id"] != "770":
                        raise
            time.sleep(relax_time)
    finally:
        # Move all clients back
        for client in clientlist:
            try:
                ts3conn.clientmove(clid=client["clid"], cid=client["cid"])
            except ts3.query.TS3QueryError as err:
                if err.resp.error["id"] != "770":
                    raise
    return None
def whirlpool ( ts3conn , duration = 10 , relax_time = 0.5 ) : # Countdown till whirlpool for i in range ( 5 , 0 , - 1 ) : ts3conn . sendtextmessage ( targetmode = ts3 . definitions . TextMessageTargetMode . SERVER , target = 0 , msg = "Whirpool in {}s" . format ( i ) ) time . sleep ( 1 ) # Fetch the clientlist and the channellist. clientlist = ts3conn . clientlist ( ) channellist = ts3conn . channellist ( ) # Ignore query clients clientlist = [ client for client in clientlist if client [ "client_type" ] != "1" ] # Whirpool with one channel or no users is boring. if len ( channellist ) == 1 or not clientlist : return None # We need this try-final construct to make sure, that all # clients will be in the same channel at the end of the # whirlpool as to the beginning. try : end_time = time . time ( ) + duration while end_time > time . time ( ) : for client in clientlist : clid = client [ "clid" ] cid = random . choice ( channellist ) [ "cid" ] try : ts3conn . clientmove ( clid = clid , cid = cid ) except ts3 . query . TS3QueryError as err : # Only ignore 'already member of channel error' if err . resp . error [ "id" ] != "770" : raise time . sleep ( relax_time ) finally : # Move all clients back for client in clientlist : try : ts3conn . clientmove ( clid = client [ "clid" ] , cid = client [ "cid" ] ) except ts3 . query . TS3QueryError as err : if err . resp . error [ "id" ] != "770" : raise return None