Made the bot a bit less keen to respond to messages. WIll now only trigger the bot if the first word is waiton, housejob, etc.
This commit is contained in:
parent
10c2999bb0
commit
219ae0c832
Binary file not shown.
12
WaitonBot.py
12
WaitonBot.py
|
|
@ -5,6 +5,8 @@ from SlackUtil import *
|
||||||
from WaitonUtil import handleWaitonMsg #For waitons
|
from WaitonUtil import handleWaitonMsg #For waitons
|
||||||
from ScrollUtil import handleScrollMsg #For scrolls
|
from ScrollUtil import handleScrollMsg #For scrolls
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
#Read api token from file
|
#Read api token from file
|
||||||
apifile = open("apitoken.txt", 'r')
|
apifile = open("apitoken.txt", 'r')
|
||||||
SLACK_API = next(apifile).strip()
|
SLACK_API = next(apifile).strip()
|
||||||
|
|
@ -39,6 +41,10 @@ def handleProfilelessScum(slack, msg, user, for_user=None):
|
||||||
f_response = "Set up your profile before talking to me, scum.\n\nThat is to say, fill out your first and last name in your slack user profile! Please use what would be on the waiton list (IE your proper name, not a nickname)."
|
f_response = "Set up your profile before talking to me, scum.\n\nThat is to say, fill out your first and last name in your slack user profile! Please use what would be on the waiton list (IE your proper name, not a nickname)."
|
||||||
reply(slack, msg, f_response)
|
reply(slack, msg, f_response)
|
||||||
|
|
||||||
|
|
||||||
|
waiton_pattern = re.compile("^waiton")
|
||||||
|
scroll_pattern = re.compile("^scroll")
|
||||||
|
housejob_pattern = re.compile("^(house)?job")
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
#Init slack
|
#Init slack
|
||||||
|
|
@ -68,13 +74,13 @@ def main():
|
||||||
elif for_user and not isValidProfile(for_user):#invalid for_user profile
|
elif for_user and not isValidProfile(for_user):#invalid for_user profile
|
||||||
handleProfilelessScum(slack, msg, user, for_user)
|
handleProfilelessScum(slack, msg, user, for_user)
|
||||||
|
|
||||||
elif "waiton" in text:
|
elif waiton_pattern.match(text):
|
||||||
handleWaitonMsg(slack, sheet_service, msg, user, for_user)
|
handleWaitonMsg(slack, sheet_service, msg, user, for_user)
|
||||||
|
|
||||||
elif "scroll" in text:
|
elif scroll_pattern.match(text):
|
||||||
handleScrollMsg(slack, msg)
|
handleScrollMsg(slack, msg)
|
||||||
|
|
||||||
elif "housejob" in text:
|
elif housejob_pattern.match(text):
|
||||||
reply(slack, msg, "I cannot do that (yet)", username="sadbot")
|
reply(slack, msg, "I cannot do that (yet)", username="sadbot")
|
||||||
|
|
||||||
elif killswitch == msg['text'].lower():
|
elif killswitch == msg['text'].lower():
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue