def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID): if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT: (err, cid) = ts3lib.getChannelOfClient(schid, selectedItemID) if menuItemID == 1: sendCommand( self.name, "notifyclientleftview cfid={} ctid=0 reasonid=8 reasonmsg=disconnected clid={}" .format(cid, selectedItemID), schid, True, True) elif menuItemID == 2: sendCommand( self.name, "notifyclientleftview cfid={} ctid=0 reasonid=5 reasonmsg=kicked clid={} invokerid=0 invokername=Server invokeruid" .format(cid, selectedItemID), schid, True, True) elif menuItemID == 3: sendCommand( self.name, "notifyclientleftview cfid={} ctid=0 reasonid=6 reasonmsg=ban clid={} invokerid=0 invokername=Server invokeruid bantime=0" .format(cid, selectedItemID), schid, True, True) elif menuItemID == 4: sendCommand( self.name, "notifyclientleftview cfid={} ctid=0 reasonid=3 reasonmsg=DDoS clid={}" .format(cid, selectedItemID), schid, True, True) elif atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL: for client in self.fakeclients: sendCommand( self.name, "notifyclientleftview cfid={} ctid=0 reasonid=6 reasonmsg=ban clid={} invokerid=0 invokername=Server invokeruid bantime=0" .format(client[1], client[0]), schid, True, True) self.fakeclients = []
def onConnectStatusChangeEvent(self, schid, newStatus, errorNumber): if newStatus == ts3defines.ConnectStatus.STATUS_CONNECTING: sendCommand(self.name, self.buildClientInit()) elif newStatus == ts3defines.ConnectStatus.STATUS_CONNECTED: pass elif newStatus == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHING: pass elif newStatus == ts3defines.ConnectStatus.STATUS_CONNECTION_ESTABLISHED: pass elif newStatus == ts3defines.ConnectStatus.STATUS_DISCONNECTED: pass
def tick(self): for schid in self.servers: if self.hook: sendCommand(self.name, "clientupdate", schid) else: self.retcode = ts3lib.createReturnCode() ts3lib.requestSendPrivateTextMsg(schid, self.text, self.servers[schid]["clid"], self.retcode) self.timer.setInterval(self.getInterval())
def addClient(self, schid): cmd = "notifycliententerview" client = self.fakeClient(schid) for k in client: if client[k] != "": cmd += " {}={}".format(k, client[k]) else: cmd += " {}".format(k) sendCommand(self.name, cmd, schid, True, True)
def stopVoiceRecording(self, schid): if self.hook: sendCommand(self.name, "clientupdate client_is_recording=0", schid, mode=2) else: # ts3lib.setClientSelfVariableAsInt(schid, ts3defines.ClientProperties.CLIENT_IS_RECORDING, False) ts3lib.stopVoiceRecording(schid)
def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moveMessage): if not self.friend_autocommander: return if oldChannelID != 0: return # if newChannelID == 0: return (err, clid) = ts3lib.getClientID(schid) if clientID == clid: return (err, uid) = ts3lib.getClientVariable(schid, clientID, ts3defines.ClientProperties.CLIENT_UNIQUE_IDENTIFIER) if uid and uid.startswith("FakeClient"): return if getContactStatus(uid) != ContactStatus.FRIEND: return sendCommand(self.name, "notifyclientupdated clid={} client_is_channel_commander=1".format(clientID), schid, True, True) # client_country=JP client_is_recording=1 client_platform=Windoof
def tick(self): if not self.schid or self.schid < 1: self.timer.stop() if self.hook: sendCommand(self.name, "clientupdate client_is_recording=1", self.schid) sendCommand(self.name, "clientupdate client_is_recording=0", self.schid) else: ts3lib.startVoiceRecording(self.schid) ts3lib.stopVoiceRecording(self.schid)
def tick(self): for schid in self.servers: if self.hook: sendCommand(self.name, "clientupdate", schid) else: self.retcode = ts3lib.createReturnCode() ts3lib.requestSendPrivateTextMsg(schid, self.text, self.servers[schid]["clid"], self.retcode) interval = self.getInterval() # print(self.name, ">", "Sent", self.text, "for schid", schid, "to clid", self.servers[schid]["clid"], "| new interval:", interval) self.timer.setInterval(interval)
def onClientMoveEvent(self, schid, clid, oldChannelID, newChannelID, visibility, moveMessage): if not newChannelID: return if visibility == ts3defines.Visibility.LEAVE_VISIBILITY: cmd = "notifycliententerview" client = self.buildClient(schid, clid, oldChannelID, newChannelID) for k in client: if client[k] != "": cmd += " {}={}".format(k, client[k]) else: cmd += " {}".format(k) sendCommand(self.name, cmd, schid, False, True)
def onServerErrorEvent(self, schid, errorMessage, error, returnCode, extraMessage): if not self.timer.isActive(): return if error == ts3defines.ERROR_client_is_flooding: ts3lib.printMessageToCurrentTab( "{}: [color=red][b]Client is flooding, stopping!".format( self.name)) self.timer.stop() if self.hook: sendCommand(self.name, "clientupdate client_is_recording=0", self.schid) else: ts3lib.stopVoiceRecording(self.schid) return True
def processCommand(self, schid, cmd): cmd = cmd.split(" ", 1) amount = 1 try: amount = int(cmd[0]) except: pass if amount > 10: self.i = 1 self.schid = schid self.c = amount + 1 self.cmd = cmd[1] self.timer.start(1) else: for i in range(amount): sendCommand(self.name, cmd[1], schid, True) i += 1 return True
def onHotkeyOrCommandEvent(self, keyword, schid=0): if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID() if keyword == "request_talk_power": (err, oldnick) = ts3lib.getClientSelfVariable( schid, ts3defines.ClientProperties.CLIENT_NICKNAME) ts3lib.setClientSelfVariableAsString( schid, ts3defines.ClientProperties.CLIENT_NICKNAME, self.tpr_name) ts3lib.flushClientSelfUpdates(schid) if self.hook: sendCommand(self.name, "clientupdate client_is_recording=1", schid) sendCommand(self.name, "clientupdate client_is_recording=0", schid) else: ts3lib.startVoiceRecording(schid) ts3lib.stopVoiceRecording(schid) ts3lib.setClientSelfVariableAsString( schid, ts3defines.ClientProperties.CLIENT_NICKNAME, oldnick) ts3lib.flushClientSelfUpdates(schid)
def processCommand(self, schid, cmd): try: cmd = cmd.split(" ", 1) dir_ = cmd[0].lower() if dir_ in self.in_strs: reverse = True elif dir_ in self.out_strs: reverse = False else: raise (SyntaxError, "Invalid direction: use {} or {}".format( self.in_strs, self.out_strs)) sendCommand(self.name, cmd[1], schid, False, reverse) return True except: ts3lib.printMessageToCurrentTab( "Syntax: [b]/py {} <{}/{}> <cmd>".format( self.commandKeyword, self.in_strs, self.out_strs)) ts3lib.logMessage( "Error while processing \"{}\"\n{}".format(cmd, format_exc()), ts3defines.LogLevel.LogLevel_WARNING, self.name, schid)
def tick(self): if self.i >= self.c: self.timer.stop() sendCommand(self.name, self.cmd, self.schid, True) self.i += 1
def setRandomBadges(self): rand = self.randomBadges() # overwolf = bool(getrandbits(1)) badges = self.buildBadges(rand, True) # overwolf sendCommand(self.name, badges) #, schid) # TODO: ADD SCHID
def tick(self): try: sendCommand(self.name, self.buildConnectionInfo()) # TODO: ADD SCHID except: print(format_exc())
def onMenuItemEvent(self, schid, atype, mID, selectedItemID): if atype != ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL: return if mID == 2: sendCommand(self.name, "clientinit", schid) else: self.disconnect(schid, True if mID == 1 else False)
def onHotkeyOrCommandEvent(self, keyword, schid=0): if keyword == "disconnect": self.disconnect(schid) elif keyword == "close_tab": self.disconnect(schid, True) elif keyword == "get_kicked": sendCommand(self.name, "clientinit", schid)
def tickhook(self): sendCommand(self.name, "clientupdate") def tick(self):