示例#1
0
def sarcasticball(data, debug, sender, users, prefix):
    arg = data.lower().replace(prefix + "sarcasticball ", "")
    arg = arg.replace(prefix + "sball ", "")
    if debug:
        print sender + ":" + prefix + "sarcasticball", arg
    choice = fsample(sarcastic_responses)
    if "USER" in choice:
        choice = choice.replace("USER", fsample(users), 1)
        choice = choice.replace("USER", fsample(users), 1)
    if "NOUN" in choice:
        choice = choice.replace("NOUN", fsample(nouns), 1)
    if "LOCATION" in choice:
        choice = choice.replace("LOCATION", fsample(locations), 1)
    if debug:
        print "Responded with", choice
    return (choice)
def sarcasticball(data,debug,sender,users,prefix):
  arg = data.lower().replace(prefix+"sarcasticball ","")
  arg = arg.replace(prefix+"sball ","")
  if debug:
    print sender+":"+prefix+"sarcasticball", arg
  choice = fsample(sarcastic_responses)
  if "USER" in choice:
    choice = choice.replace("USER",fsample(users),1)
    choice = choice.replace("USER",fsample(users),1)
  if "NOUN" in choice:
    choice = choice.replace("NOUN",fsample(nouns),1)
  if "LOCATION" in choice:
    choice = choice.replace("LOCATION",fsample(locations),1)
  if debug:
     print "Responded with", choice
  return(choice)
def eightball(data,debug,sender,prefix):
  global responses
  arg = data.lower().replace(prefix+"eightball ","")
  arg = arg.replace(prefix+"8ball ","")
  if debug:
     print sender+":"+prefix+"eightball", arg
  if "answer" in arg and "everything" in arg and "to" in arg:
     if debug:
       print "Responded with",42
     return "42"
  elif arg == "derp":
    if debug:
      print "Responded with herp"
    return("herp")
  elif arg == "herp":
    if debug:
      print "Responded with derp"
    return("derp")
  else:
     #choice = sample(responses,1)[0]
     choice = fsample(responses)
     if debug:
        print "Responded with", choice
     return(choice)