Exemple #1
0
 def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID, visibility, moveMessage):
     if schid != self.schid: return
     (err, ownID) = ts3lib.getClientID(schid)
     if clientID != ownID: return
     if not self.request_tp: return
     self.request_tp = False
     (err, needed_tp) = ts3lib.getChannelVariable(schid, newChannelID, ts3defines.ChannelPropertiesRare.CHANNEL_NEEDED_TALK_POWER)
     if needed_tp >=0:
         (err, ownTP) = ts3lib.getClientSelfVariable(schid, ts3defines.ClientPropertiesRare.CLIENT_TALK_POWER)
         if int(ownTP) < needed_tp: ts3lib.requestIsTalker(schid, True, "")
Exemple #2
0
 def jokeReply(self, reply):
     if not self.toggle == 1: return
     joke = json.loads(reply.readAll().data().decode('utf-8'))["joke"]
     ts3lib.logMessage("Requesting talk power with joke\n%s" % joke,
                       ts3defines.LogLevel.LogLevel_INFO, self.name,
                       self.schid)
     msg = joke[:50]
     if self.debug:
         ts3lib.printMessageToCurrentTab('[{0}] msg: {1}'.format(
             self.name, msg))
     ts3lib.requestIsTalker(self.schid, True, msg)
Exemple #3
0
 def tick(self):
     if self.debug:
         ts3lib.printMessageToCurrentTab(
             'toggle: {0} | schid: {1} | count: {2} | interval: {3} | active: {4}'
             .format(self.toggle, self.schid, self.count, self.interval,
                     self.active))
     if not self.active or self.toggle != 2: return
     self.count += 1
     ts3lib.requestIsTalker(self.schid, False, "")
     ts3lib.requestIsTalker(self.schid, True,
                            "Request #{}".format(self.count))
Exemple #4
0
 def jokeReply(self, reply):
     joke = json.loads(reply.readAll().data().decode('utf-8'))["joke"]
     ts3lib.logMessage("Requesting talk power with joke\n%s" % joke,
                       ts3defines.LogLevel.LogLevel_INFO, self.name,
                       self.schid)
     if self.msg == "": msg = joke[:50]
     else: msg = self.msg
     if self.debug:
         ts3lib.printMessageToCurrentTab('[{0}] msg: {1}'.format(
             self.name, msg))
     try:
         ts3lib.requestIsTalker(self.schid, True, msg)
         self.schid = 0
     except:
         from traceback import format_exc
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)
Exemple #5
0
 def onClientMoveEvent(self, schid, clientID, oldChannelID, newChannelID,
                       visibility, moveMessage):
     if not self.toggle or schid != self.schid: return
     (error, ownid) = ts3lib.getClientID(schid)
     if ownid != clientID: return
     if not self.talker():
         if self.toggle == 1:
             if self.msg != "":
                 self.nwmc = QNetworkAccessManager()
                 self.nwmc.connect("finished(QNetworkReply*)",
                                   self.jokeReply)
                 self.nwmc.get(
                     QNetworkRequest(
                         QUrl("http://tambal.azurewebsites.net/joke/random")
                     ))
             else:
                 ts3lib.requestIsTalker(schid, True, self.msg)
         elif self.toggle == 2:
             self.active = True
     else:
         if self.toggle == 2:
             self.active = False