Added debug out to waitonbot. Fixed scrollutil.

This commit is contained in:
Jacob Henry 2016-10-27 21:26:25 +00:00
parent 56a5e406b9
commit 4fa9a9f842
2 changed files with 10 additions and 4 deletions

View File

@ -37,14 +37,14 @@ def handleScrollMsg(slack, msg):
if not m:
response = "Could not parse your query. Please invoke as \"scroll <name>\" or \"scroll <scroll#>\""
else:
response = getResponseByQuery()
response = getResponseByQuery(m.group(1))
reply(slack, msg, response, username="scrollbot")
def getResponseByQuery(query):
try:
#Try get scroll number
scroll = int(m.group(1).strip())
scroll = int(query)
b = findBrotherByScroll(scroll)
if b:
@ -53,7 +53,7 @@ def getResponseByQuery(query):
return "Could not find scroll {0}".format(scroll)
except ValueError:
#Use as name
name = m.group(1).strip()
name = query
b = findBrotherByName(name)
if b:
@ -77,5 +77,5 @@ def findBrotherByName(name):
"""
#Do fuzzy match
return process.extractOne(name, brothers, processor=lambda b: b["name"])
return process.extractOne(name, brothers, processor=lambda b: b["name"])[0]

View File

@ -70,17 +70,23 @@ def main():
#Handle Message
text = msg['text'].lower()
if not isValidProfile(user):#invalid profile
print("Received profileless")
handleProfilelessScum(slack, msg, user)
elif for_user and not isValidProfile(for_user):#invalid for_user profile
print("Received for profileless")
handleProfilelessScum(slack, msg, user, for_user)
elif waiton_pattern.match(text):
print("Received waiton from " + user['user']['name'])
handleWaitonMsg(slack, sheet_service, msg, user, for_user)
elif scroll_pattern.match(text):
print("Received scroll from " + user['user']['name'])
handleScrollMsg(slack, msg)
elif housejob_pattern.match(text):
print("Received housejob from " + user['user']['name'])
reply(slack, msg, "I cannot do that (yet)", username="sadbot")
elif killswitch == msg['text'].lower():