def commandToggleRecord(self, schid, targetMode, toID, fromID, params=""): (error, clid) = ts3lib.getClientID(schid) (error, recording) = ts3lib.getClientVariableAsInt(schid, clid, ts3defines.ClientProperties.CLIENT_IS_RECORDING) if not recording: ts3lib.startVoiceRecording(schid) elif recording: ts3lib.stopVoiceRecording(schid)
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 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 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 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)