Das hier wäre die Config Datei
Code: Alles auswählen
# List of server's ids, names and the related TS3 group id
SERVERS = [
{"id": 2207, "name": "Dzagonur", "group_id": "13"},
{"id": 2014, "name": "Gunnars Feste", "group_id": "14"},
]
# The API bot's default TS3 channel
CHANNEL_ID = 54
# TS3 virtual server
SERVER_ID = 1
# Login data
CLIENT_NICK = "XXXXX"
CLIENT_USER = "TS3Bot"
CLIENT_PASS = "XXXXX"
# Login data for cycle.py
#CYCLE_USER = "CycleBot"
#CYCLE_PASS = "IRmc1f7d"
# TS3 connection details
QUERY_HOST = "localhost"
TS3_PROTOCOL = "telnet"
# MySQL server
SQL_HOST = "localhost"
SQL_PORT = 3306
SQL_USER = "root"
SQL_PASS = "XXXX"
SQL_DB = "TSBOT"
und hier der erste Teil vom Bot
Code: Alles auswählen
class Bot:
def __init__(self):
self.commands = []
# Register commands
for _ in commands.__all__:
mod = import_module("commands.{}".format(_))
mod.REGEX = re.compile(mod.MESSAGE_REGEX)
logging.info("Registered command.{}".format(_))
self.commands.append(mod)
# Connect to TS3
self.ts3c = ts3.query.TS3ServerConnection(
"{}://{}:{}@{}".format(
config.TS3_PROTOCOL,
config.CLIENT_USER,
config.CLIENT_PASS,
config.QUERY_HOST,
)
)
und aufschlagen tut er dann am ende im :
Code: Alles auswählen
addrlist = []
_logger.info("Created connection to {}:{}:{}:{}:{}:{}.".format(host, port, family, type, proto, flags))
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
af, socktype, proto, canonname, sa = res
addrlist.append((_intenum_converter(af, AddressFamily),
_intenum_converter(socktype, SocketKind),
proto, canonname, sa))
_logger.info("Created connection to {}.".format(addrlist))
return addrlist
welches aber eine std. funktion von dem Package ist.
es laufen alle Dienste auf einem Server..
Den Connection String baut er so auf:
2019-07-10 06:09:11 - ts3.query - INFO - Created connection to telnet://user:
passwd@ts.wvwdzagonur.de:None.
2019-07-10 06:09:11 - ts3.query - INFO - Created connection to telnet://user:
passwd@ts.wvwdzagonur.de:10011:<object object at 0x7f8591f9b0c0>.
2019-07-10 06:09:11 - socket - INFO - Created connection to telnet://user:
passwd@ts.wvwdzagonur.de:10011.
2019-07-10 06:09:11 - socket - INFO - Created connection to telnet://user:
passwd@ts.wvwdzagonur.de:10011:0:1:0:0.