I have made a small script with Python and the PyTS3 module to mutate from my client automatically to all users connected to a TeamSpeak3 server that has not been added to my friends list.
It connects to the client through an add-on called ClientQuery, which brings Team Speak by default. (ClientQuery: offers a local telnet interface on port 25639 to remotely control the TeamSpeak 3 client).
My code is:
import ts3
import os
import sqlite3
#apikey
apikey = open("API-Key.txt", "r").read()
def TS3_Muter():
#import friendlist
friendlist = []
with sqlite3.connect("C:/Users/" + str(os.getenv("username")) + "/AppData/Roaming/TS3Client/settings.db") as database:
cursor = database.cursor()
cursor.execute("SELECT * FROM Contacts;")
rows = cursor.fetchall()
for row in rows:
row = str(row)
nickname = row[(row.find("Nickname=") + 9):row.find("\nFriend")]
code = int(row[(row.find("\nFriend=") + 9): row.find("\nAutomute")])
if code == 0:
friendlist.append(nickname)
#ts3
with ts3.query.TS3ClientConnection("localhost") as connection:
connection.exec_("auth", apikey=apikey)
connection.exec_("use")
for client in connection.exec_("clientlist"):
if client["client_nickname"] not in friendlist:
connection.exec_("clientmute", clid=client["clid"])
else:
connection.exec_("clientunmute", clid=client["clid"])
connection.exec_("quit")
while 1:
TS3_Muter()
The script itself works perfectly, but after the first 1-3 minutes of execution, it ends up crashing with the following message in the console:
ConnectionAbortedError: [WinError 10053] A connection established by the software on your host computer has been aborted [Finished in 77.165s]
I have tried to run it by previously disabling the firewall, but the problem persists.
Would anyone know why this error is leaking, or how to fix it? Thank you very much in advance.