def onClientDBIDfromUIDEvent(self, serverConnectionHandlerID, uniqueClientIdentifier, clientDatabaseID): if self.toggle: #if self.requestedUID != "" and self.requestedUID[0] == uniqueClientIdentifier: _schid = ts3.getCurrentServerConnectionHandlerID() #_uid = self.requestedUID.pop(0) _cid = self.requestedC.pop(0) #_clid = ts3.requestClientIDs([_schid], uniqueClientIdentifier) #_cgid = ts3.getClientVariableAsInt(_schid, _clid, ts3defines.ClientPropertiesRare.CLIENT_CHANNEL_GROUP_ID) if _cid == 0 and self.autoMod: # and _cgid != self.smgroup ts3.requestSetClientChannelGroup(_schid, [self.smgroup], self.ownchannels, [clientDatabaseID]) ts3.printMessageToCurrentTab( "[color=green]Gave Client [URL=client://0/" + uniqueClientIdentifier + "]" + uniqueClientIdentifier + "[/URL] Channel Mod in #" + str(self.ownchannels) + "[/color]") elif _cid == 1 and self.autoBan: # and _cgid != self.sbgroup ts3.requestSetClientChannelGroup(_schid, [self.sbgroup], self.ownchannels, [clientDatabaseID]) ts3.printMessageToCurrentTab( "[color=red]Banned Client [URL=client://0/" + uniqueClientIdentifier + "]" + uniqueClientIdentifier + "[/URL] from Channels #" + str(self.ownchannels) + "[/color]")
def __init__(self): ts3.printMessageToCurrentTab( '[{:%Y-%m-%d %H:%M:%S}]'.format(datetime.datetime.now()) + " [color=orange]" + self.name + "[/color] Plugin for pyTSon by [url=https://github.com/Bluscream]Bluscream[/url] loaded." ) self.conn = sqlite3.connect(ts3.getConfigPath() + "settings.db")
def processCommand(self, schid, command): tokens = command.split(' ') if tokens[0] == "pcmd": ts3.sendPluginCommand(schid, tokens[1], ts3defines.PluginTargetMode.PluginCommandTarget_SERVER, []);return True elif tokens[0] == "meta": if tokens[1] == "get": schid = ts3.getCurrentServerConnectionHandlerID() error, ownid = ts3.getClientID(schid) if error == ts3defines.ERROR_ok: # requestClientVariables(schid, ownid) error, meta = ts3.getClientVariableAsString(schid, ownid, ts3defines.ClientProperties.CLIENT_META_DATA) if error == ts3defines.ERROR_ok: ts3.printMessageToCurrentTab(meta);return True else: ts3.printMessageToCurrentTab("Error: Can't get own meta data.");return True else: ts3.printMessageToCurrentTab("Error: Can't get own clientID.");return True elif tokens[1] == "set": schid = ts3.getCurrentServerConnectionHandlerID() error = ts3.setClientSelfVariableAsString(schid, ts3defines.ClientProperties.CLIENT_META_DATA, tokens[2]) if not error == ts3defines.ERROR_ok: ts3.printMessageToCurrentTab("Error: Unable to set own meta data.");return True else: return True else: ts3.printMessageToCurrentTab("ERROR: Command \""+tokens[0]+"\" not found!");return True return False
def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID): if menuItemID == 0: self.toggle = not self.toggle ts3.printMessageToCurrentTab( '[{:%Y-%m-%d %H:%M:%S}] '.format(datetime.datetime.now()) + " Set Auto Channel Commander to [color=yellow]" + str(self.toggle) + "[/color]")
def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID): if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL: if menuItemID == 0: ts3.printMessageToCurrentTab("toggle: "+str(self.toggle)+" | debug: "+str(self.toggle)+" | channels: "+str(self.channels)) elif atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL: if menuItemID == 1: self.channels = [selectedItemID] ts3.printMessageToCurrentTab('[{:%Y-%m-%d %H:%M:%S}] '.format(datetime.datetime.now())+" Set target channel to [color=yellow]"+str(self.channels)+"[/color]") elif menuItemID == 2: if not self.channels.__contains__(selectedItemID): self.channels.extend([selectedItemID]) ts3.printMessageToCurrentTab('[{:%Y-%m-%d %H:%M:%S}] '.format(datetime.datetime.now())+" Added [color=yellow]"+str(selectedItemID)+"[/color] to target channels: "+str(self.channels)) else: ts3.printMessageToCurrentTab('[{:%Y-%m-%d %H:%M:%S}] '.format(datetime.datetime.now())+" Channel [color=yellow]"+str(selectedItemID)+"[/color] is already in list: "+str(self.channels)) elif menuItemID == 3: self.channels.remove(selectedItemID) ts3.printMessageToCurrentTab('[{:%Y-%m-%d %H:%M:%S}] '.format(datetime.datetime.now())+" Removed [color=yellow]"+str(selectedItemID)+"[/color] from target channels: "+str(self.channels)) elif atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT: if menuItemID == 1: self.setClientChannelGroup(selectedItemID, 10, "Channel Admin") return elif menuItemID == 2: self.setClientChannelGroup(selectedItemID, 11, "Operator") return elif menuItemID == 3: self.setClientChannelGroup(selectedItemID, 9, "Guest") return elif menuItemID == 4: self.setClientChannelGroup(selectedItemID, 12, "Channel Bann") return elif menuItemID == 5: self.setClientChannelGroup(selectedItemID, 13, "Joinpower") return
def on_btn_apply_clicked(self): ts3.printMessageToCurrentTab("on_btn_apply_clicked") info.cfg.set('general', 'Debug', str(self.chk_debug.isChecked())) info.cfg.set('general', 'Colored', str(self.chk_colored.isChecked())) info.cfg.set('general', 'Autorequest Server Variables', str(self.chk_arsv.isChecked())) info.cfg.set('general', 'Autorequest Client Variables', str(self.chk_arcv.isChecked())) # for with open(info.ini, 'w') as configfile: info.cfg.write(configfile)
def onPluginCommandEvent(self, serverConnectionHandlerID, pluginName, pluginCommand): _f = "Plugin message by \"" + pluginName + "\": " + pluginCommand ts3.logMessage( '{:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now()) + " " + _f, ts3defines.LogLevel.LogLevel_INFO, self.name, 0) if self.cfg.getboolean('general', 'Debug'): ts3.printMessageToCurrentTab(_f) print(_f)
def setClientChannelGroup(self, selectedItemID, channelGroupID, channelGroupName): schid = ts3.getCurrentServerConnectionHandlerID() (error, dbid) = ts3.getClientVariableAsUInt64( schid, selectedItemID, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) ts3.requestSetClientChannelGroup(schid, [channelGroupID], self.channels, [dbid]) ts3.printMessageToCurrentTab("Client " + str(dbid) + " has now the group \"" + channelGroupName + "\" in Channel #" + str(self.channels))
def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID): if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL: if menuItemID == 0: self.toggle = not self.toggle ts3.printMessageToCurrentTab( '[{:%Y-%m-%d %H:%M:%S}] '.format(datetime.datetime.now()) + " Set Auto Channel Commander to [color=yellow]" + str(self.toggle) + "[/color]") elif atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL: if menuItemID == 0: self.ownchannels.extend([selectedItemID]) ts3.printMessageToCurrentTab("[color=green]Added[/color] #" + str(selectedItemID) + " to list of channels: " + str(self.ownchannels)) elif menuItemID == 1: self.ownchannels.remove(selectedItemID) ts3.printMessageToCurrentTab("[color=red]Removed[/color] #" + str(selectedItemID) + " from list of channels: " + str(self.ownchannels)) elif atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT: if menuItemID == 0: schid = ts3.getCurrentServerConnectionHandlerID() (error, uid) = ts3.getClientVariableAsString( schid, selectedItemID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) _i = self.checkUser(uid) ts3.printMessageToCurrentTab("Client " + str(uid) + " = " + _i) # IMPORTANT
def configDialogClosed(self, r, vals): try: ts3.printMessageToCurrentTab("vals: "+str(vals)) if r == QDialog.Accepted: for name, val in vals.items(): try: if not val == self.cfg.getboolean('general', name): self.cfg.set('general', str(name), str(val)) except: from traceback import format_exc ts3.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0) with open(self.ini, 'w') as configfile: self.cfg.write(configfile) except: from traceback import format_exc ts3.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0)
def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID): if menuItemID == 0: schid = ts3.getCurrentServerConnectionHandlerID() (error, item) = ts3.getClientDisplayName(schid, selectedItemID) ts3.printMessageToCurrentTab( '[{:%Y-%m-%d %H:%M:%S}] '.format(datetime.datetime.now()) + " [color=green]Added[/color] [color=yellow]" + item + "[/color] to Report Moderators.") if menuItemID == 1: schid = ts3.getCurrentServerConnectionHandlerID() (error, item) = ts3.getClientDisplayName(schid, selectedItemID) ts3.printMessageToCurrentTab( '[{:%Y-%m-%d %H:%M:%S}] '.format(datetime.datetime.now()) + " [color=red]Removed[/color] [color=yellow]" + item + "[/color] from Report Moderators.") if menuItemID == 2: self.dlg = ReportDialog(None) self.dlg.show()
def configDialogClosed(self, r, vals): try: ts3.printMessageToCurrentTab("vals: " + str(vals)) if r == QDialog.Accepted: for name, val in vals.items(): try: if not val == self.cfg.getboolean('general', name): self.cfg.set('general', str(name), str(val)) except: from traceback import format_exc ts3.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0) with open(self.ini, 'w') as configfile: self.cfg.write(configfile) except: from traceback import format_exc ts3.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0)
def processCommand(self, schid, command): tokens = command.split(' ') if tokens[0] == "pcmd": ts3.sendPluginCommand( schid, tokens[1], ts3defines.PluginTargetMode.PluginCommandTarget_SERVER, []) return True elif tokens[0] == "meta": if tokens[1] == "get": schid = ts3.getCurrentServerConnectionHandlerID() error, ownid = ts3.getClientID(schid) if error == ts3defines.ERROR_ok: # requestClientVariables(schid, ownid) error, meta = ts3.getClientVariableAsString( schid, ownid, ts3defines.ClientProperties.CLIENT_META_DATA) if error == ts3defines.ERROR_ok: ts3.printMessageToCurrentTab(meta) return True else: ts3.printMessageToCurrentTab( "Error: Can't get own meta data.") return True else: ts3.printMessageToCurrentTab( "Error: Can't get own clientID.") return True elif tokens[1] == "set": schid = ts3.getCurrentServerConnectionHandlerID() error = ts3.setClientSelfVariableAsString( schid, ts3defines.ClientProperties.CLIENT_META_DATA, tokens[2]) if not error == ts3defines.ERROR_ok: ts3.printMessageToCurrentTab( "Error: Unable to set own meta data.") return True else: return True else: ts3.printMessageToCurrentTab("ERROR: Command \"" + tokens[0] + "\" not found!") return True return False
def __init__(self): self.dlg = None if os.path.isfile(self.ini): self.cfg.read(self.ini) else: self.cfg['general'] = { "Debug": "False", "Colored": "False", "Autorequest Server Variables": "False", "Autorequest Client Variables": "False" } self.cfg.add_section('VirtualServerProperties');self.cfg.add_section('VirtualServerPropertiesRare'); self.cfg.add_section('ChannelProperties');self.cfg.add_section('ChannelPropertiesRare'); self.cfg.add_section('ClientProperties');self.cfg.add_section('ClientPropertiesRare'); self.cfg.add_section('ConnectionProperties');self.cfg.add_section('ConnectionPropertiesRare') self.cfg.set("VirtualServerProperties", "LAST_REQUESTED", "True");self.cfg.set("VirtualServerProperties", "TYPE", "True") for name, value in getmembers(ts3defines.VirtualServerProperties): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER'): self.cfg.set("VirtualServerProperties", name, "False") for name, value in getmembers(ts3defines.VirtualServerPropertiesRare): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER_RARE'): self.cfg.set("VirtualServerPropertiesRare", name, "False") self.cfg.set("ChannelProperties", "LAST_REQUESTED", "True");self.cfg.set("ChannelProperties", "TYPE", "True") for name, value in getmembers(ts3defines.ChannelProperties): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER'): self.cfg.set("ChannelProperties", name, "False") for name, value in getmembers(ts3defines.ChannelPropertiesRare): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER_RARE'): self.cfg.set("ChannelPropertiesRare", name, "False") self.cfg.set("ClientProperties", "LAST_REQUESTED", "True");self.cfg.set("ClientProperties", "TYPE", "True") for name, value in getmembers(ts3defines.ClientProperties): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER'): self.cfg.set("ClientProperties", name, "False") for name, value in getmembers(ts3defines.ClientPropertiesRare): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER_RARE'): self.cfg.set("ClientPropertiesRare", name, "False") for name, value in getmembers(ts3defines.ConnectionProperties): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER'): self.cfg.set("ConnectionProperties", name, "False") for name, value in getmembers(ts3defines.ConnectionPropertiesRare): if not name.startswith('__') and not '_DUMMY_' in name and not name.endswith('_ENDMARKER_RARE'): self.cfg.set('ConnectionPropertiesRare', name, 'False') with open(self.ini, 'w') as configfile: self.cfg.write(configfile) ts3.logMessage(self.name+" script for pyTSon by "+self.author+" loaded from \""+__file__+"\".", ts3defines.LogLevel.LogLevel_INFO, "Python Script", 0) if self.cfg.getboolean('general', 'Debug'): ts3.printMessageToCurrentTab('[{:%Y-%m-%d %H:%M:%S}]'.format(datetime.datetime.now())+" [color=orange]"+self.name+"[/color] Plugin for pyTSon by [url=https://github.com/"+self.author+"]"+self.author+"[/url] loaded.")
def onClientPokeEvent(self, serverConnectionHandlerID, fromClientID, pokerName, pokerUID, message, ffIgnored): #is it me? (err, schids) = ts3.getServerConnectionHandlerList() if err == ts3defines.ERROR_ok: for schid in schids: (err, myid) = ts3.getClientID(schid) if err == ts3defines.ERROR_ok: if fromClientID == myid: return 0 else: ts3.printMessageToCurrentTab("error getting own client id") else: ts3.printMessageToCurrentTab("error getting schids") (err, name) = ts3.getClientVariableAsString( serverConnectionHandlerID, fromClientID, ts3defines.ClientProperties.CLIENT_NICKNAME) if err != ts3defines.ERROR_ok: err = ts3.requestClientPoke(serverConnectionHandlerID, fromClientID, "Ne!") else: err = ts3.requestClientPoke(serverConnectionHandlerID, fromClientID, "%s? Ne!" % name) self.lastpoker = (serverConnectionHandlerID, fromClientID) if err != ts3defines.ERROR_ok: ts3.printMessageToCurrentTab("poke error: %d" % err) return 0 else: return 1
def __init__(self): self.dlg = None if os.path.isfile(self.ini): self.cfg.read(self.ini) else: self.cfg['general'] = { "Debug": "False", "Colored": "False", "Autorequest Server Variables": "False", "Autorequest Client Variables": "False" } self.cfg.add_section('VirtualServerProperties') self.cfg.add_section('VirtualServerPropertiesRare') self.cfg.add_section('ChannelProperties') self.cfg.add_section('ChannelPropertiesRare') self.cfg.add_section('ClientProperties') self.cfg.add_section('ClientPropertiesRare') self.cfg.add_section('ConnectionProperties') self.cfg.add_section('ConnectionPropertiesRare') self.cfg.set("VirtualServerProperties", "LAST_REQUESTED", "True") self.cfg.set("VirtualServerProperties", "TYPE", "True") for name, value in getmembers(ts3defines.VirtualServerProperties): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER'): self.cfg.set("VirtualServerProperties", name, "False") for name, value in getmembers( ts3defines.VirtualServerPropertiesRare): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER_RARE'): self.cfg.set("VirtualServerPropertiesRare", name, "False") self.cfg.set("ChannelProperties", "LAST_REQUESTED", "True") self.cfg.set("ChannelProperties", "TYPE", "True") for name, value in getmembers(ts3defines.ChannelProperties): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER'): self.cfg.set("ChannelProperties", name, "False") for name, value in getmembers(ts3defines.ChannelPropertiesRare): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER_RARE'): self.cfg.set("ChannelPropertiesRare", name, "False") self.cfg.set("ClientProperties", "LAST_REQUESTED", "True") self.cfg.set("ClientProperties", "TYPE", "True") for name, value in getmembers(ts3defines.ClientProperties): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER'): self.cfg.set("ClientProperties", name, "False") for name, value in getmembers(ts3defines.ClientPropertiesRare): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER_RARE'): self.cfg.set("ClientPropertiesRare", name, "False") for name, value in getmembers(ts3defines.ConnectionProperties): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER'): self.cfg.set("ConnectionProperties", name, "False") for name, value in getmembers(ts3defines.ConnectionPropertiesRare): if not name.startswith( '__') and not '_DUMMY_' in name and not name.endswith( '_ENDMARKER_RARE'): self.cfg.set('ConnectionPropertiesRare', name, 'False') with open(self.ini, 'w') as configfile: self.cfg.write(configfile) ts3.logMessage( self.name + " script for pyTSon by " + self.author + " loaded from \"" + __file__ + "\".", ts3defines.LogLevel.LogLevel_INFO, "Python Script", 0) if self.cfg.getboolean('general', 'Debug'): ts3.printMessageToCurrentTab( '[{:%Y-%m-%d %H:%M:%S}]'.format(datetime.datetime.now()) + " [color=orange]" + self.name + "[/color] Plugin for pyTSon by [url=https://github.com/" + self.author + "]" + self.author + "[/url] loaded.")
def __init__(self,info, parent=None): super(QDialog, self).__init__(parent) setupUi(self, os.path.join(ts3.getPluginPath(), "pyTSon", "scripts", "info", "settings.ui")) self.setWindowTitle("Extended Info Settings") ts3.printMessageToCurrentTab(str(info.cfg.getboolean('general', 'Debug'))) self.chk_debug.setChecked(info.cfg.getboolean('general', 'Debug')) self.chk_colored.setChecked(info.cfg.getboolean('general', 'Colored')) self.chk_arsv.setChecked(info.cfg.getboolean('general', 'Autorequest Server Variables')) self.chk_arcv.setChecked(info.cfg.getboolean('general', 'Autorequest Client Variables')) for name, value in info.cfg['VirtualServerProperties'].items(): _item = QListWidgetItem(self.lst_server) _item.setToolTip(name) _item.setStatusTip('VirtualServerProperties') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText(name.replace('VIRTUALSERVER_', '').replace('_', ' ').title()) for name, value in info.cfg['VirtualServerPropertiesRare'].items(): _item = QListWidgetItem(self.lst_server) _item.setToolTip(name) _item.setStatusTip('VirtualServerPropertiesRare') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText(name.replace('VIRTUALSERVER_', '').replace('_', ' ').title()) for name, value in info.cfg['ChannelProperties'].items(): _item = QListWidgetItem(self.lst_channel) _item.setToolTip(name) _item.setStatusTip('ChannelProperties') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText(name.replace('CHANNEL_', '').replace('_', ' ').title()) for name, value in info.cfg['ChannelPropertiesRare'].items(): _item = QListWidgetItem(self.lst_channel) _item.setToolTip(name) _item.setStatusTip('ChannelPropertiesRare') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText(name.replace('CHANNEL_', '').replace('_', ' ').title()) for name, value in info.cfg['ClientProperties'].items(): _item = QListWidgetItem(self.lst_client) _item.setToolTip(name) _item.setStatusTip('ClientProperties') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText(name.replace('CLIENT_', '').replace('_', ' ').title()) for name, value in info.cfg['ClientPropertiesRare'].items(): _item = QListWidgetItem(self.lst_client) _item.setToolTip(name) _item.setStatusTip('ClientPropertiesRare') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText(name.replace('CLIENT_', '').replace('_', ' ').title()) for name, value in info.cfg['ConnectionProperties'].items(): _item = QListWidgetItem(self.lst_client) _item.setToolTip(name) _item.setStatusTip('ConnectionProperties') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText(name.replace('CONNECTION_', '').replace('_', ' ').title()) for name, value in info.cfg['ConnectionPropertiesRare'].items(): _item = QListWidgetItem(self.lst_client) _item.setToolTip(name) _item.setStatusTip('ConnectionPropertiesRare') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText(name.replace('CONNECTION_', '').replace('_', ' ').title())
def onPluginCommandEvent(self, serverConnectionHandlerID, pluginName, pluginCommand): _f = "Plugin message by \""+pluginName+"\": "+pluginCommand ts3.logMessage('{:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now())+" "+_f, ts3defines.LogLevel.LogLevel_INFO, self.name, 0) if self.cfg.getboolean('general', 'Debug'): ts3.printMessageToCurrentTab(_f) print(_f)
def processCommand(self, schid, command): if command.startswith("test"): ts3.printMessageToCurrentTab("Status: " + str(self.toggle)) ts3.printMessageToCurrentTab("Ban: " + str(self.sbgroup)) ts3.printMessageToCurrentTab("Mod: " + str(self.smgroup)) ts3.printMessageToCurrentTab("Admin: " + str(self.sagroup)) ts3.printMessageToCurrentTab("Own Channels: " + str(self.ownchannels)) #ts3.printMessageToCurrentTab("requestedUIDs: "+str(self.requestedUID)) ts3.printMessageToCurrentTab("requestedCs: " + str(self.requestedC)) return True if command.startswith("addchan"): command = int(command.split("addchan ")[1]) self.ownchannels.extend([command]) ts3.printMessageToCurrentTab("[color=green]Added[/color] #" + str(command) + " to list of channels: " + str(self.ownchannels)) return True if command.startswith("delchan"): command = int(command.split("delchan ")[1]) self.ownchannels.remove([command]) ts3.printMessageToCurrentTab("[color=red]Removed[/color] #" + str(command) + " from list of channels: " + str(self.ownchannels)) return True if command == "checkall": self.checkAllUsers() return True
def configDialogClosed(self, r, vals): if r == QDialog.Accepted: ts3.printMessageToCurrentTab( "the user has chosen, that debug is now: %s" % vals['debug'])
def onUpdateClientEvent(self, serverConnectionHandlerID, clientID, invokerID, invokerName, invokerUniqueIdentifier): if self.requested: self.requested = False (error, _uid) = ts3.getClientVariableAsString( serverConnectionHandlerID, clientID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) if not self._sent.__contains__(_uid): return if self.checkOutdatedVersion: (error, targetVer) = ts3.getClientVariableAsString( serverConnectionHandlerID, clientID, ts3defines.ClientProperties.CLIENT_VERSION) if error != ts3defines.ERROR_ok: return ts3.printMessageToCurrentTab("targetVer: " + targetVer) targetVer = targetVer.split("Build: ") targetVer = targetVer[1] targetVer = int(targetVer.split("]")[0]) if targetVer < self.currentVersion: (error, country) = ts3.getClientVariableAsString( serverConnectionHandlerID, clientID, ts3defines.ClientPropertiesRare.CLIENT_COUNTRY) if country == "DE" or country == "CH" or country == "AT": ts3.requestSendPrivateTextMsg( serverConnectionHandlerID, "[color=red]Hinweis[/color]:\n\nDu nutzt eine veraltete Version von Teamspeak.\nBitte aktualisiere deinen Client auf Version [color=blue]" + self.currentVersion_ + "[/color]", clientID) self._sent.extend([_uid]) else: ts3.requestSendPrivateTextMsg( serverConnectionHandlerID, "[color=red]Attention[/color]:\n\nYou are using an outdated Teamspeak.\nPlease update your Client to Version [color=blue]" + self.currentVersion_ + "[/color]", clientID) self._sent.extend([_uid]) if self.checkUnreadMessages: (error, platform) = ts3.getClientVariableAsString( serverConnectionHandlerID, clientID, ts3defines.ClientProperties.CLIENT_PLATFORM) if platform != "Android" and platform != "iOS": (error, messages) = ts3.getClientVariableAsInt( serverConnectionHandlerID, clientID, ts3defines.ClientPropertiesRare.CLIENT_UNREAD_MESSAGES) ts3.printMessageToCurrentTab("messages: " + str(messages)) if messages > 1: (error, country) = ts3.getClientVariableAsString( serverConnectionHandlerID, clientID, ts3defines.ClientPropertiesRare.CLIENT_COUNTRY) ts3.printMessageToCurrentTab("country: " + country) if country == "DE" or country == "CH" or country == "AT": ts3.requestSendPrivateTextMsg( serverConnectionHandlerID, "[color=orange]Hinweis[/color]:\n\nDu hast [color=blue]eine[/color] ungelesene Offline Nachricht.\nDu kannst sie nachlesen indem du auf \"Extras\" => \"Offline Nachrichten\" klickst oder einfach [STRG]+[O] auf deiner Tastatur drückst.", clientID) self._sent.extend([_uid]) else: ts3.requestSendPrivateTextMsg( serverConnectionHandlerID, "[color=orange]Reminder[/color]:\n\nYou have [color=blue]one[/color] unread offline message.\nYou can read it by clicking on \"Tools\" => \"Offline Messages\" or pressing [CTRL]+[O] on your keyboard.", clientID) self._sent.extend([_uid]) elif messages == 1: (error, country) = ts3.getClientVariableAsString( serverConnectionHandlerID, clientID, ts3defines.ClientPropertiesRare.CLIENT_COUNTRY) if country == "DE" or country == "CH" or country == "AT": ts3.requestSendPrivateTextMsg( serverConnectionHandlerID, "[color=orange]Hinweis[/color]:\n\nDu hast [color=blue]" + str(messages) + "[/color] ungelesene Offline Nachrichten.\nDu kannst sie nachlesen indem du auf \"Extras\" => \"Offline Nachrichten\" klickst oder einfach [STRG]+[O] auf deiner Tastatur drückst.", clientID) self._sent.extend([_uid]) else: ts3.requestSendPrivateTextMsg( serverConnectionHandlerID, "[color=orange]Reminder[/color]:\n\nYou have [color=blue]" + str(messages) + "[/color] unread offline messages.\nYou can read them by clicking on \"Tools\" => \"Offline Messages\" or pressing [CTRL]+[O] on your keyboard.", clientID) self._sent.extend([_uid])
def __init__(self): ts3.printMessageToCurrentTab( '[{:%Y-%m-%d %H:%M:%S}]'.format(datetime.datetime.now()) + " [color=orange]" + self.name + "[/color] Plugin for pyTSon by [url=https://github.com/Bluscream]Bluscream[/url] loaded." )
def __init__(self): config = configparser.ConfigParser() if os.path.isfile(self.ini): config.read(self.ini) #self.SERVER = config['SERVER'].items() self.CHANNEL = config['CHANNEL'].items() #self.CLIENT = config['CLIENT'].items() for key in self.CHANNEL: ts3.printMessageToCurrentTab( str(key[0]).title() + ": " + str(key[1])) else: config['GENERAL'] = {"Debug": "False", "Colored": "False"} config['SERVER'] = { "Last Requested": "True", "Name": "False", "Phonetic Name": "False", "Version": "False", "Platform": "False", "Clients": "False", "Channels": "False", "Connections": "False", "Uptime": "False", "Address": "False", "Resolved IP": "False", "Icon ID": "False", "License": "False", "UID": "False", "ID": "False", "Machine ID": "False", "Autostart": "False", "Password": "******", "Codec Encrypted": "False", "Default Groups": "False", "Max Bandwith": "False", "Banner": "False", "Hostbutton": "False", "Complaint Settings": "False", "Clients for forced Silence": "False", "Priority speaker dimm": "False", "Antiflood": "False", "Up/Download Quota": "False", "Month Bytes Transfered": "False", "Total Bytes Transfered": "False", "Needed Security Level": "False", "Log Settings": "False", "Min Client Version": "False", "Weblist Status": "False", "Privilege Key": "False", "Delete Channels after": "False" } config['CHANNEL'] = { "Last Requested": "False", "Name": "False", "Phonetic Name": "False", "ID": "False", "Topic": "False", "Clients": "False", "Needed Talk Power": "False", "Order": "False", "Codec": "False", "Flags": "False", "Subscribed": "False", "Encrypted": "False", "Description": "False", "Icon ID": "False", "Delete Delay": "False", "Filepath": "False" } config['CLIENT'] = { "Last Requested": "False", "Name": "False", "Phonetic Name": "False", "Version": "False", "Platform": "False", "Country": "False", "Client ID": "False", "Database ID": "False", "UID": "False", "Is Talking": "False", "Audio Status": "False", "Idle Time": "False", "Default Channel": "False", "Server Password": "******", "Volume Modifcator": "False", "Version Sign": "False", "Security Hash": "False", "Last Var Request": "False", "Login Credentials": "False", "Group ID's": "False", "First Connection": "False", "Last Connection": "False", "Total Connections": "False", "Away": "False", "Talk Power": "False", "Talk Power Request": "False", "Description": "False", "Is Talker": "False", "Month Bytes Transfered": "False", "Total Bytes Transfered": "False", "Is Priority Speaker": "False", "Unread Offline Messages": "False", "Needed ServerQuery View Power": "False", "Default Token": "False", "Meta Data": "False" } with open(self.ini, 'w') as configfile: config.write(configfile) ts3.printMessageToCurrentTab( '[{:%Y-%m-%d %H:%M:%S}]'.format(datetime.datetime.now()) + " [color=orange]" + self.name + "[/color] Plugin for pyTSon by [url=https://github.com/Bluscream]Bluscream[/url] loaded." )
def __init__(self, info, parent=None): super(QDialog, self).__init__(parent) setupUi( self, os.path.join(ts3.getPluginPath(), "pyTSon", "scripts", "info", "settings.ui")) self.setWindowTitle("Extended Info Settings") ts3.printMessageToCurrentTab( str(info.cfg.getboolean('general', 'Debug'))) self.chk_debug.setChecked(info.cfg.getboolean('general', 'Debug')) self.chk_colored.setChecked(info.cfg.getboolean('general', 'Colored')) self.chk_arsv.setChecked( info.cfg.getboolean('general', 'Autorequest Server Variables')) self.chk_arcv.setChecked( info.cfg.getboolean('general', 'Autorequest Client Variables')) for name, value in info.cfg['VirtualServerProperties'].items(): _item = QListWidgetItem(self.lst_server) _item.setToolTip(name) _item.setStatusTip('VirtualServerProperties') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText( name.replace('VIRTUALSERVER_', '').replace('_', ' ').title()) for name, value in info.cfg['VirtualServerPropertiesRare'].items(): _item = QListWidgetItem(self.lst_server) _item.setToolTip(name) _item.setStatusTip('VirtualServerPropertiesRare') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText( name.replace('VIRTUALSERVER_', '').replace('_', ' ').title()) for name, value in info.cfg['ChannelProperties'].items(): _item = QListWidgetItem(self.lst_channel) _item.setToolTip(name) _item.setStatusTip('ChannelProperties') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText( name.replace('CHANNEL_', '').replace('_', ' ').title()) for name, value in info.cfg['ChannelPropertiesRare'].items(): _item = QListWidgetItem(self.lst_channel) _item.setToolTip(name) _item.setStatusTip('ChannelPropertiesRare') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText( name.replace('CHANNEL_', '').replace('_', ' ').title()) for name, value in info.cfg['ClientProperties'].items(): _item = QListWidgetItem(self.lst_client) _item.setToolTip(name) _item.setStatusTip('ClientProperties') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText( name.replace('CLIENT_', '').replace('_', ' ').title()) for name, value in info.cfg['ClientPropertiesRare'].items(): _item = QListWidgetItem(self.lst_client) _item.setToolTip(name) _item.setStatusTip('ClientPropertiesRare') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText( name.replace('CLIENT_', '').replace('_', ' ').title()) for name, value in info.cfg['ConnectionProperties'].items(): _item = QListWidgetItem(self.lst_client) _item.setToolTip(name) _item.setStatusTip('ConnectionProperties') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText( name.replace('CONNECTION_', '').replace('_', ' ').title()) for name, value in info.cfg['ConnectionPropertiesRare'].items(): _item = QListWidgetItem(self.lst_client) _item.setToolTip(name) _item.setStatusTip('ConnectionPropertiesRare') if value.lower() == "true": _item.setCheckState(Qt.Checked) else: _item.setCheckState(Qt.Unchecked) _item.setText( name.replace('CONNECTION_', '').replace('_', ' ').title())
def processCommand(self, schid, command): tokens = command.split(' ') if len(tokens) == 0: return True (err, myid) = ts3.getClientID(schid) if err != ts3defines.ERROR_ok: ts3.printMessageToCurrentTab("Error getting client id: (%s, %s)" % (err, ts3.getErrorMessage(err)[1])) return True (err, cid) = ts3.getChannelOfClient(schid, myid) if err != ts3defines.ERROR_ok: ts3.printMessageToCurrentTab("Error getting channel id: (%s, %s)" % (err, ts3.getErrorMessage(err)[1])) return True if tokens[0] == "time": err = ts3.requestSendChannelTextMsg(schid, "It's %s" % time.asctime(time.localtime(time.time())), cid) if err != ts3defines.ERROR_ok: ts3.printMessageToCurrentTab("Error sending txt message: (%s, %s)" % (err, ts3.getErrorMessage(err)[1])) return True elif tokens[0] == "greet": (err, svname) = ts3.getServerVariableAsString(schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_NAME) if err != ts3defines.ERROR_ok: ts3.printMessageToCurrentTab("Error getting server name: (%s, %s)" % (err, ts3.getErrorMessage(err)[1])) return True (err, cname) = ts3.getChannelVariableAsString(schid, cid, ts3defines.ChannelProperties.CHANNEL_NAME) if err != ts3defines.ERROR_ok: ts3.printMessageToCurrentTab("Error getting channel name: (%s, %s)" % (err, ts3.getErrorMessage(err)[1])) return True err = ts3.requestSendChannelTextMsg(schid, "Welcome in %s on %s" % (cname, svname), cid) if err != ts3defines.ERROR_ok: ts3.printMessageToCurrentTab("Error sending txt message: (%s, %s)" % (err, ts3.getErrorMessage(err)[1])) return True