예제 #1
0
 def onMenuItemEvent(self, serverConnectionHandlerID, atype, menuItemID, selectedItemID):
     if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL:
         if menuItemID == 0: 
             #self.reconnect(serverConnectionHandlerID)
             ownID = ts3lib.getClientID(serverConnectionHandlerID)[1]
             channelID = ts3lib.getChannelOfClient(serverConnectionHandlerID, ownID)[1]
             channelPassword = ts3lib.getChannelConnectInfo(serverConnectionHandlerID, channelID, 256)[2]
             ts3lib.printMessageToCurrentTab(channelPassword)
             ts3lib.playWaveFile(serverConnectionHandlerID, path.join(self.soundPath, "yee.wav"))
             ts3lib.printMessageToCurrentTab("F**k off. You know this has no use. Like your life. Pew Pew.")
         if menuItemID == 1:
             self.antiMoveStatus = not self.antiMoveStatus
             ts3lib.printMessageToCurrentTab("{0}Set {1} to [color=green]{2}[/color]".format(timestamp(), self.name, self.antiMoveStatus))
         if menuItemID == 2:
             self.antiChannelKickStatus = not self.antiChannelKickStatus
             ts3lib.printMessageToCurrentTab("{0}Set {1} to [color=green]{2}[/color]".format(timestamp(), self.name, self.antiChannelKickStatus))
         if menuItemID == 3:
             self.antiServerKickStatus = not self.antiServerKickStatus
             ts3lib.printMessageToCurrentTab("{0}Set {1} to [color=green]{2}[/color]".format(timestamp(), self.name, self.antiServerKickStatus))
         if menuItemID == 4:
             self.antiServerBanStatus = not self.antiServerBanStatus
             ts3lib.printMessageToCurrentTab("{0}Set {1} to [color=green]{2}[/color]".format(timestamp(), self.name, self.antiServerBanStatus))
         if menuItemID == 5:
             self.backup(serverConnectionHandlerID)
             ts3lib.printMessageToCurrentTab("{0}[color=green]Backup complete![/color]".format(timestamp()))
예제 #2
0
 def onClientBanFromServerEvent(self, serverConnectionHandlerID, clientID, oldChannelID, newChannelID, visibility, kickerID, kickerName, kickerUniqueIdentifier, time, kickMessage):
     try:
         ts3lib.playWaveFile(serverConnectionHandlerID, path.join(self.soundPath, "ahfuck.wav"))
         ts3lib.printMessageToCurrentTab("f**k")
         if self.cfg['antiserverban']['enabled'] != 'False' and self.antiServerBanStatus != False:
             if time != 0 and time < self.maxSleepTime:
                 tabID = int(self.cfg['data']['tabID'])
                 ip = self.cfg['data']['ip']
                 port = self.cfg['data']['port']
                 #serverPw = self.cfg['general']['serverpw']
                 serverPw = self.currentServerPW
                 nickname = self.cfg['data']['nickname']
                 channelList = []
                 channelPw = self.cfg['general']['channelpw']
                 identity = self.cfg['general']['identity']
                 address = ip + ":" + port
                 if time > 30:
                     time = time + 1
                 self.sleep(time)
                 (error, schid) = ts3lib.guiConnect(tabID, "Server", address, serverPw, nickname, "", channelPw, "default", "default", "default", "default", identity, "", "")
                 if self.cfg['antiserverban']['rejoinchannel'] != "False":
                     self.rejoinChannel = True
                     self.oldChannelID = oldChannelID
             self.backup(schid)
             #identity = self.cfg['data']['identityPrefix'] + self.cfg['data']['currentID']
             #(error, schid) = ts3lib.guiConnect(tabID, "Server", address, serverPw, nickname, "", channelPw, "", "", "", "default", identity, "", "")
             #self.cfg['data']['currentID'] = self.cfg['data']['currentID'] + 1
     except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0)
예제 #3
0
 def onHotkeyEvent(self, keyword):
     if keyword == "toggleMove":
         self.antiMoveStatus = not self.antiMoveStatus
         schid = ts3lib.getCurrentServerConnectionHandlerID()
         if self.antiMoveStatus:
             ts3lib.playWaveFile(schid, path.join(self.soundPath, "on.wav"))
         else:
             ts3lib.playWaveFile(schid, path.join(self.soundPath, "off.wav"))
         ts3lib.printMessageToCurrentTab("{0}{1}: Set Anti-Move to [color=green]{2}[/color]".format(timestamp(), self.name, self.antiMoveStatus))
     return
예제 #4
0
 def processCommand(self, serverConnectionHandlerID, command):
     if command == "toggleMove":
         self.antiMoveStatus = not self.antiMoveStatus
         if self.antiMoveStatus:
             ts3lib.playWaveFile(serverConnectionHandlerID, path.join(self.soundPath, "on.wav"))
         else:
             ts3lib.playWaveFile(serverConnectionHandlerID, path.join(self.soundPath, "off.wav"))
         ts3lib.printMessageToCurrentTab("{0}{1}: Set Anti-Move to [color=green]{2}[/color]".format(timestamp(), self.name, self.antiMoveStatus))
         return True
     else:
         return False
     return False
예제 #5
0
 def onClientMoveMovedEvent(self, serverConnectionHandlerID, clientID, oldChannelID, newChannelID, visibility, moverID, moverName, moverUniqueIdentifier, moveMessage):
     try:
         if self.cfg['antimove']['enabled'] != 'False' and self.antiMoveStatus != False:
             if serverConnectionHandlerID != 0:
                 mClientID = ts3lib.getClientID(serverConnectionHandlerID)
                 if mClientID[1] == clientID:
                     self.TryJoinChannel(serverConnectionHandlerID, clientID, oldChannelID)
                     self.backup(serverConnectionHandlerID)
                     ts3lib.playWaveFile(serverConnectionHandlerID, path.join(self.soundPath, "noice.wav"))
                     if self.cfg['antimove']['message'] == 'True': 
                         message = 'Stop it ' + moverName + '!'
                         ts3lib.requestSendPrivateTextMsg(serverConnectionHandlerID, message, moverID) 
     except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0)
예제 #6
0
 def onHotkeyOrCommandEvent(self, keyword, schid=0):
     try:
         if not schid: schid = ts3lib.getCurrentServerConnectionHandlerID()
         if keyword == "test":
             msg = [
                 "moveBeforeBan", self.moveBeforeBan, "sgids", self.sgids,
                 "lastchans", self.lastchans, "last_joined_server",
                 self.last_joined_server, "last_joined_channel",
                 self.last_joined_channel, "last_talk_power",
                 self.last_talk_power, "requested", self.requested,
                 "requestedIP", self.requestedIP, "retcode", self.retcode
             ]
             print(msg)
             ts3lib.printMessageToCurrentTab(' '.join(str(x) for x in msg))
         elif keyword == "restrict_last_joined_server":
             self.requested = self.last_joined_server
             msg = self.cfg.get("restrict", "poke")
             if msg: ts3lib.requestClientPoke(schid, self.requested, msg)
             ts3lib.requestClientVariables(schid, self.last_joined_server)
             # self.restrictClient(schid, self.last_joined_server)
         elif keyword == "restrict_last_joined_channel":
             self.requested = self.last_joined_channel
             msg = self.cfg.get("restrict", "poke")
             if msg: ts3lib.requestClientPoke(schid, self.requested, msg)
             ts3lib.requestClientVariables(schid, self.last_joined_channel)
             # self.restrictClient(schid, self.last_joined_channel)
         elif keyword == "ban_last_joined_server":
             msg = self.cfg.get("ban", "poke")
             if msg:
                 ts3lib.requestClientPoke(schid, self.last_joined_server,
                                          msg)
             self.banClient(schid, self.last_joined_server)
         elif keyword == "ban_last_joined_channel":
             msg = self.cfg.get("ban", "poke")
             if msg:
                 ts3lib.requestClientPoke(schid, self.last_joined_channel,
                                          msg)
             self.banClient(schid, self.last_joined_channel)
         elif keyword == "revoke_last_talk_power_channel":
             self.revokeTalkPower(schid, self.last_talk_power)
         elif keyword == "restrict_last_joined_channel_from_local_channels":
             self.restrictForeigners(schid, self.last_joined_channel)
         elif keyword == "last_joined_channel_to_customBan":
             self.toCustomBan(schid, self.last_joined_channel)
         elif keyword == "last_joined_server_to_customBan":
             self.toCustomBan(schid, self.last_joined_server)
         elif keyword == "selected_to_customBan":
             window = self.app.activeWindow()
             if window is None or not window.className() == "MainWindow":
                 return
             selected = widget("ServerTreeView", self.app).currentIndex()
             if not selected: return
             name = selected.data()
             item = getIDByName(name, schid)
             if item[1] != ServerTreeItemType.CLIENT:
                 ts3lib.playWaveFile(schid,
                                     path.join(self.path, "error.wav"))
                 ts3lib.printMessageToCurrentTab(
                     "{}: [color=red]No client with name[/color] {} [color=red]found![/color]"
                     .format(self.name, name))
                 return
             self.toCustomBan(schid, item[0])
         elif keyword == "join_selected_channel_pw":
             window = self.app.activeWindow()
             if window is None or not window.className() == "MainWindow":
                 return
             selected = widget("ServerTreeView", self.app).currentIndex()
             if not selected: return
             name = selected.data()
             item = getIDByName(name, schid)
             if item[1] != ServerTreeItemType.CHANNEL: return
             (err, clid) = ts3lib.getClientID(schid)
             (err, cid) = ts3lib.getChannelOfClient(schid, clid)
             if cid == item[0]: return
             pw = getChannelPassword(schid, item[0], calculate=True)
             if not pw: return
             # ts3lib.printMessageToCurrentTab("{} > Joining {} (pw: {})".format(self.name, name, pw))
             ts3lib.requestClientMove(schid, clid, item[0], pw)
         elif keyword == "rejoin_last_channel_pw":
             (err, clid) = ts3lib.getClientID(schid)
             (err, cid) = ts3lib.getChannelOfClient(schid, clid)
             tcid = self.lastchans[schid]
             if cid == tcid: return
             pw = getChannelPassword(schid, tcid, calculate=True)
             # (err, name) = ts3lib.getChannelVariable(schid, tcid, ts3defines.ChannelProperties.CHANNEL_NAME)
             # ts3lib.printMessageToCurrentTab("{} > Rejoining {} (pw: {})".format(self.name, name, pw))
             ts3lib.requestClientMove(schid, clid, tcid,
                                      pw if pw else "123")
     except:
         print("error")
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)
     return True
예제 #7
0
 def playWaveFile(self, path):
     err = ts3lib.playWaveFile(self.schid, path)
     if err != ts3defines.ERROR_ok:
         raise ts3Error("Error playing wav file: (%s, %s)" %
                        (err, ts3lib.getErrorMessage(err)[1]))