mirror of
https://github.com/nikdoof/python-ts3.git
synced 2026-01-31 10:08:20 +00:00
Add some sensible defaults, stop TS3Server requiring connection details to instance
This commit is contained in:
@@ -91,7 +91,7 @@ class TS3Proto():
|
|||||||
self._logger = logging.getLogger(__name__)
|
self._logger = logging.getLogger(__name__)
|
||||||
return self._logger
|
return self._logger
|
||||||
|
|
||||||
def connect(self, ip, port, timeout=5):
|
def connect(self, ip, port=10011, timeout=5):
|
||||||
try:
|
try:
|
||||||
self._telnet = telnetlib.Telnet(ip, port)
|
self._telnet = telnetlib.Telnet(ip, port)
|
||||||
except telnetlib.socket.error:
|
except telnetlib.socket.error:
|
||||||
@@ -253,7 +253,7 @@ class TS3Proto():
|
|||||||
|
|
||||||
|
|
||||||
class TS3Server(TS3Proto):
|
class TS3Server(TS3Proto):
|
||||||
def __init__(self, ip, port, id=0):
|
def __init__(self, ip=None, port=10011, id=0):
|
||||||
"""
|
"""
|
||||||
Abstraction class for TS3 Servers
|
Abstraction class for TS3 Servers
|
||||||
|
|
||||||
@@ -263,6 +263,7 @@ class TS3Server(TS3Proto):
|
|||||||
@type port: int
|
@type port: int
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
if ip and port:
|
||||||
if self.connect(ip, port) and id > 0:
|
if self.connect(ip, port) and id > 0:
|
||||||
self.use(id)
|
self.use(id)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user