Follow better python formatting guidelines.

master
josiah 5 years ago
parent 5094afba60
commit b27189bc88

@ -4,13 +4,13 @@ import slack
EXAMPLE_COMMAND = "do" EXAMPLE_COMMAND = "do"
MENTION_REGEX = "^<@(|[WU].+)>(.*)" MENTION_REGEX = "^<@(|[WU].+)>(.*)"
bot_channel = "bots-like-gaston" BOT_CHANNEL = "bots-like-gaston"
def parse_direct_mention(message_text): def parse_direct_mention(message_text):
""" """
Finds a direct mention (a mention that is at the beginning) in message text Finds a direct mention (a mention that is at the beginning) in message text
and returns the user ID which was mentioned. If there is no direct mention, returns None and returns the user ID which was mentioned. If there is no direct mention, returns None
""" """
matches = re.search(MENTION_REGEX, message_text) matches = re.search(MENTION_REGEX, message_text)
# the first group contains the username, the second group contains the remaining message # the first group contains the username, the second group contains the remaining message
@ -18,7 +18,8 @@ def parse_direct_mention(message_text):
def reactable_string(text): def reactable_string(text):
"""Return regex objects matching interesting strings """
Return regex objects matching interesting strings
""" """
reactable_array = [] reactable_array = []
if re.search(r"\bai\b", text.lower()) is not None: if re.search(r"\bai\b", text.lower()) is not None:
@ -91,10 +92,7 @@ def handle_messages(**payload):
) )
if __name__ == '__main__': if __name__ == '__main__':
slack_token = os.environ["SLACK_API_TOKEN"] SLACK_TOKEN = os.environ["SLACK_API_TOKEN"]
client = slack.WebClient(token=os.environ['SLACK_API_TOKEN']) CLIENT = slack.WebClient(token=os.environ['SLACK_API_TOKEN'])
rtm_client = slack.RTMClient(token=slack_token) RTM_CLIENT = slack.RTMClient(token=SLACK_TOKEN)
rtm_client.start() RTM_CLIENT.start()

Loading…
Cancel
Save