diff --git a/mojo-rtm/mojo-rtm.py b/mojo-rtm/mojo-rtm.py index 9de3f3e..b3e3666 100644 --- a/mojo-rtm/mojo-rtm.py +++ b/mojo-rtm/mojo-rtm.py @@ -4,13 +4,13 @@ import slack EXAMPLE_COMMAND = "do" MENTION_REGEX = "^<@(|[WU].+)>(.*)" -bot_channel = "bots-like-gaston" +BOT_CHANNEL = "bots-like-gaston" def parse_direct_mention(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 + 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 """ matches = re.search(MENTION_REGEX, message_text) # 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): - """Return regex objects matching interesting strings + """ + Return regex objects matching interesting strings """ reactable_array = [] if re.search(r"\bai\b", text.lower()) is not None: @@ -91,10 +92,7 @@ def handle_messages(**payload): ) if __name__ == '__main__': - slack_token = os.environ["SLACK_API_TOKEN"] - client = slack.WebClient(token=os.environ['SLACK_API_TOKEN']) - rtm_client = slack.RTMClient(token=slack_token) - rtm_client.start() - - - + SLACK_TOKEN = os.environ["SLACK_API_TOKEN"] + CLIENT = slack.WebClient(token=os.environ['SLACK_API_TOKEN']) + RTM_CLIENT = slack.RTMClient(token=SLACK_TOKEN) + RTM_CLIENT.start()