Пример #1
0
 def registerViolation(self, userName, inClanChat):
     with self._lock:
         violations = self._violations.get(userName, [])
         violations.append(
                         ChatEvent(userName, True, {'inClan': inClanChat}))
         numV = numViolations(violations)
         r = SearchPlayerRequest(self.session, userName)
         ul = self.tryRequest(r)
         uid = ul["players"][0]["userId"]
         txt = ('Hi there! You\'ve been detected adventuring in hobopolis without listening to the '
                'hobopolis chat channel! Please type "/l hobopolis" into chat before continuing '
                'to adventure in hobopolis. Thanks!')
         k = Kmail(uid=uid, text=txt)
         self.debugLog("Warning {} about chat violation".format(userName))
         self.sendKmail(k)
         self.log("Detected {} adventuring in hobopolis without being "
                  "in channel (violation number #{})!"
                  .format(userName, numV))
         self._violations[userName] = violations