@@ -0,0 +1,2115 @@
+from tehbot.plugins import *%0Aimport urllib%0Aimport urllib2%0Aimport time%0A%0Aclass RevelSolvedPoller(Poller):%0A    def prefix(self):%0A        return u%22%5BRevolution Elite%5D%22%0A%0A    def datestamp(self, ts):%0A        return time.strftime('%25Y%25m%25d%25H%25M%25S', time.localtime(ts))%0A%0A    def timestamp(self, datestamp):%0A        try:%0A            t = time.strptime(datestamp, '%25Y%25m%25d%25H%25M%25S')%0A            ts = time.mktime(t)%0A        except:%0A            ts = 0%0A        return ts%0A%0A    def execute(self, connection, event, extra, dbconn):%0A        url = %22https://www.revolutionelite.co.uk/w3ch4ll/solvers_revel.php?datestamp=%25s%22%0A%0A        try:%0A            ts = self.settings%5B%22ts%22%5D%0A        except:%0A            ts = 0%0A%0A        reply = urllib2.urlopen(url %25 self.datestamp(ts), timeout=3)%0A        entries = %5B%5D%0A%0A        for entry in reply.readlines():%0A            try:%0A                uid, cid, solvedate, firstdate, views, options, timetaken, tries, username, challname, solvercount, challurl = map(lambda x: x.replace(r%22%5C:%22, %22:%22), entry.split(%22::%22))%0A                uid = int(uid)%0A                cid = int(cid)%0A                tssolve = self.timestamp(solvedate)%0A                ts1stsolve = self.timestamp(firstdate)%0A                views = int(views)%0A                tries = int(tries)%0A                solvercount = int(solvercount) - 1%0A                entries.append((tssolve, username, challname, solvercount))%0A            except:%0A                pass%0A%0A        msgs = %5B%5D%0A        for tssolve, username, challname, solvercount in sorted(entries):%0A            ts = tssolve%0A%0A            msg = %22%25s has just solved %25s.%22 %25 (Plugin.bold(username), Plugin.bold(challname))%0A            if solvercount %3C= 0:%0A                msg += %22 This challenge has never been solved before!%22%0A            else:%0A                msg += %22 This challenge has been solved %25d time%25s before.%22 %25 (solvercount, %22%22 if solvercount == 1 else %22s%22)%0A%0A            msgs.append(u%22%25s %25s%22 %25 (Plugin.green(self.prefix()), msg))%0A%0A        self.settings%5B%22ts%22%5D = ts%0A        self.save(dbconn)%0A%0A        msg = u%22%5Cn%22.join(msgs)%0A        if msg:%0A            return %5B(%22announce%22, (self.where(), msg))%5D%0A

add RevelSolvedPoller