示例#1
0
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
示例#2
0
 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()
示例#3
0
    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()
示例#4
0
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)])
示例#5
0
def spotify(self, e, c):
    run_once(0, _spotify, [self, e, c])
示例#6
0
def urlhandler(self, e, c):
    run_once(0, _urlhandler, [self, e, c])
示例#7
0
                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()
示例#8
0
def OMG_track(self, e, c):
    """run _OMG_track in a thread"""
    run_once(0, _OMG_track, [self, e, c])