def spotify_uri(self, e, c): line = e.arguments()[0] m = re.search(spotify_uri_re,line) if m: s_url = "http://open.spotify.com/%s/%s"%(m.group(2),m.group(4)) run_once(0, _urlhandler, [self, e, c, s_url]) else: return
def do_pubcommand(self, e): nick = nm_to_n(e.source()) c = self.connection line = e.arguments()[0] if line[0] == "!" and len(line)>1: parts = line[1:].split() cmd = parts[0].lower() try: func = self.pubcommands[cmd] ircutil.run_once(0, func, [self, e, c]) except Exception, ex: print "\033[31mERROR\033[m (do_pubcommand): %s"%ex if DEBUG > 1: traceback.print_stack()
def do_command(self, e, cmd): nick = nm_to_n(e.source()) c = self.connection line = e.arguments()[0] """privcommands""" if line.startswith("!") and len(line) > 1: parts = line[1:].split() cmd = parts[0].lower() try: func = self.privcommands[cmd] ircutil.run_once(0, func, [self, e, c]) return except Exception, ex: print "%s attempting (do_command): %s"%(nick, ex) if DEBUG > 1: traceback.print_stack()
def rejoice_rejoin(self, c, channel, whokicked): c.join(channel) prkl = random.choice(kiroukset) run_once(5, c.privmsg, [channel, "%s, senkin %s!" % (whokicked, prkl)])
def spotify(self, e, c): run_once(0, _spotify, [self, e, c])
def urlhandler(self, e, c): run_once(0, _urlhandler, [self, e, c])
opers = chobj.opers() opers.sort() c.notice(nick, "Opers: " + ", ".join(opers)) voiced = chobj.voiced() voiced.sort() c.notice(nick, "Voiced: " + ", ".join(voiced)) elif line.startswith("!") and len(line) > 1: """do pubcommands in private for admins""" parts = line[1:].split() cmd = parts[0].lower() try: func = self.pubcommands[cmd] """query source -> target""" e._target = e.source() ircutil.run_once(0, func, [self, e, c]) except Exception, ex: print "\033[31mERROR\033[m (do_command [adm]): %s"%ex if DEBUG > 1: traceback.print_stack() else: c.notice(nick, "Wut, sir? : " + cmd) class TimerOperation(threading._Timer): def __init__(self, *args, **kwargs): threading._Timer.__init__(self, *args, **kwargs) self.setDaemon(True) def run(self): while True: self.finished.clear()
def OMG_track(self, e, c): """run _OMG_track in a thread""" run_once(0, _OMG_track, [self, e, c])