mirror of
https://github.com/nikdoof/python-ts3.git
synced 2025-12-17 11:59:27 +00:00
Make is_successful a property, gm/use now return boolean responses
This commit is contained in:
9
ts3.py
9
ts3.py
@@ -69,6 +69,7 @@ class TS3Response():
|
|||||||
else:
|
else:
|
||||||
self.data = []
|
self.data = []
|
||||||
|
|
||||||
|
@property
|
||||||
def is_successful(self):
|
def is_successful(self):
|
||||||
return self.response['keys']['msg'] == 'ok'
|
return self.response['keys']['msg'] == 'ok'
|
||||||
|
|
||||||
@@ -257,7 +258,7 @@ class TS3Server(TS3Proto):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
response = self.send_command('login', keys={'client_login_name': username, 'client_login_password': password })
|
response = self.send_command('login', keys={'client_login_name': username, 'client_login_password': password })
|
||||||
return response.is_successful()
|
return response.is_successful
|
||||||
|
|
||||||
def serverlist(self):
|
def serverlist(self):
|
||||||
"""
|
"""
|
||||||
@@ -272,7 +273,8 @@ class TS3Server(TS3Proto):
|
|||||||
@param msg: Message
|
@param msg: Message
|
||||||
@type ip: str
|
@type ip: str
|
||||||
"""
|
"""
|
||||||
return self.send_command('gm', keys={'msg': msg})
|
response = self.send_command('gm', keys={'msg': msg})
|
||||||
|
return response.is_successful
|
||||||
|
|
||||||
def use(self, id):
|
def use(self, id):
|
||||||
"""
|
"""
|
||||||
@@ -281,4 +283,5 @@ class TS3Server(TS3Proto):
|
|||||||
@param id: Virtual Server ID
|
@param id: Virtual Server ID
|
||||||
@type id: int
|
@type id: int
|
||||||
"""
|
"""
|
||||||
self.send_command('use', keys={'sid': id})
|
response = self.send_command('use', keys={'sid': id})
|
||||||
|
return response.is_successful
|
||||||
|
|||||||
Reference in New Issue
Block a user