示例#1
0
 def wrapperFunc(bot, trigger):
     import handmade_stream as stream
     streaming = stream.isCurrentlyStreaming()
     if (not streaming or (trigger.admin or inWhiteList(bot, trigger.nick))):
         func(bot, trigger)
     else:
         pass #Don't say anything back to the user, to avoid spam.
示例#2
0
def info(bot, trigger, text):
    """Handles directed informational text -- will either direct the text to @caller or to @nick 
        specified in the first argument. Commands which use this method should put "Info Command"
        in their docstring (and maybe in something user-facing...!infocommands?)
    """
    import handmade_stream as stream
    ###TODO(chronister): Can this be done as a decorator? (would have to give a custom bot 
    ###     or something?)
    streaming = stream.isCurrentlyStreaming()
    
    if ((streaming and trigger and trigger.admin) or not streaming):
        if (trigger):
            if (trigger.group(2)):

                args = trigger.group(2).split(" ")
                if (args[0][0] == "@"): 
                    args[0] = args[0][1:]

                if (args[0].lower() != "cmuratori"):
                    bot.say("@%s: %s" % (args[0], text))
                else:
                    bot.say("@%s: Please do not direct info at Casey." % trigger.nick)
            else:
                bot.say("@%s: %s" % (trigger.nick, text))
        else:
            bot.say(text)
    else:
        #temporary measure: whitelist to admins
            pass
示例#3
0
 def wrapperFunc(bot, trigger):
     import handmade_stream as stream
     streaming = stream.isCurrentlyStreaming()
     if (not streaming or trigger.admin):
         func(bot, trigger)
     else:
         pass  #Don't say anything back to the user, to avoid spam.
示例#4
0
def googleSearch(bot,trigger):
    """Command that searches google for the string provided
    """
    if not trigger: return
    if stream.isCurrentlyStreaming() and not trigger.admin: return
    if not trigger.group(2):
        bot.say("@%s: https://google.com/" % trigger.nick)
    else:
        query = trigger.group(2).strip()
        bot.say("@%s: %s" % (trigger.nick, google_search(query)))
示例#5
0
def googleSearch(bot, trigger):
    """Command that searches google for the string provided
    """
    if not trigger: return
    if stream.isCurrentlyStreaming() and not trigger.admin: return
    if not trigger.group(2):
        bot.say("@%s: https://google.com/" % trigger.nick)
    else:
        query = trigger.group(2).strip()
        bot.say("@%s: %s" % (trigger.nick, google_search(query)))
示例#6
0
def msdnSearch(bot, trigger):
    """Command that searches msdn for the string provided in the command arguments. Performs this
        with the Google API and site:msdn.microsoft.com
    """
    ###TODO(chronister): Add hidden C++ keyword to search?
    ###TODO(chronister): Are there any subdomains we don't want? See commented -site above
    if not trigger: return
    if stream.isCurrentlyStreaming() and not trigger.admin: return
    if not trigger.group(2):
        bot.say("@%s: http://msdn.microsoft.com/" % trigger.nick)
    else:
        query = trigger.group(2).strip()
        bot.say("@%s: %s" % (trigger.nick, google(query)))
示例#7
0
def msdnSearch(bot, trigger):
    """Command that searches msdn for the string provided in the command arguments. Performs this
        with the Google API and site:msdn.microsoft.com
    """
    ###TODO(chronister): Add hidden C++ keyword to search?
    ###TODO(chronister): Are there any subdomains we don't want? See commented -site above
    if not trigger: return
    if stream.isCurrentlyStreaming() and not trigger.admin: return
    if not trigger.group(2):
        bot.say("@%s: http://msdn.microsoft.com/" % trigger.nick)
    else:
        query = trigger.group(2).strip()
        bot.say("@%s: %s" % (trigger.nick, google(query)))
示例#8
0
def remindTimer(bot, trigger):
    if (isCurrentlyStreaming()):
        trigger.nick = "Timing update"
        timer(bot, trigger)
示例#9
0
def remindTimer(bot, trigger):
    if (isCurrentlyStreaming()):
        trigger.nick = "Timing update"
        timer(bot, trigger)