Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

Commit

Permalink
pep8 compliant code
Browse files Browse the repository at this point in the history
  • Loading branch information
staticdev committed May 19, 2019
1 parent 0a9a2c3 commit 8efa6fe
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions echobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
if 'name' in user and user.get('name') == SLACK_BOT_NAME:
BOT_ID = user.get('id')
else:
print("Could not reach Slack with your SLACK_BOT_TOKEN. Please check if your SLACK_BOT_TOKEN and SLACK_BOT_NAME are both correct.")
print('Could not reach Slack with your SLACK_BOT_TOKEN. Please check if ' +
'your SLACK_BOT_TOKEN and SLACK_BOT_NAME are both correct.')
exit(1)

try:
BOT_ID
except NameError:
print('Could not find bot with the name ' + SLACK_BOT_NAME + '. Please check if your SLACK_BOT_TOKEN and SLACK_BOT_NAME are both correct.')
print('Could not find bot with the name ' + SLACK_BOT_NAME + '. Please ' +
'check if your SLACK_BOT_TOKEN and SLACK_BOT_NAME are both correct.')
exit(1)


Expand Down Expand Up @@ -86,9 +88,9 @@ def handle_request(message, channel, ts, user):

# send messages to channel
slack_client.api_call('chat.postMessage',
channel=channel,
text=unmentioned_message,
as_user=True)
channel=channel,
text=unmentioned_message,
as_user=True)


def parse_slack_output(event_list):
Expand All @@ -112,9 +114,11 @@ def parse_slack_output(event_list):
if slack_client.rtm_connect():
print('%s connected', __file__)
while True:
request, channel, ts, user = parse_slack_output(slack_client.rtm_read())
request, channel, ts, user = parse_slack_output(
slack_client.rtm_read())
if request and channel:
print('slack_message:|' + str(request) + '|' + str(channel) + '|' + str(ts) + '|' + str(user) + '|')
print('slack_message:|' + str(request) + '|' + str(channel) +
'|' + str(ts) + '|' + str(user) + '|')
handle_request(request, channel, ts, user)
time.sleep(READ_WEBSOCKET_DELAY)
else:
Expand Down

0 comments on commit 8efa6fe

Please sign in to comment.