Running slack bot with python issue - AttributeError: 'WebClient' object has no attribute 'rtm_read'

Viewed 649

I am following this guide:

At the very end there is a full code snippet which I took, but there is a problem with the last part of it:

if __name__ == "__main__":
    if slack_client.rtm_connect(token = slack_token):
        print("Starter Bot connected and running!")
        # Read bot's user ID by calling Web API method `auth.test`
        starterbot_id = slack_client.api_call("auth.test")["user_id"]
        while True:
            command, channel = parse_bot_commands(slack_client.rtm_read())
            if command:
                handle_command(command, channel)
            time.sleep(RTM_READ_DELAY)
    else:
        print("Connection failed. Exception traceback printed above.")

I am getting

Starter Bot connected and running!
Traceback (most recent call last):
  File "slack2.py", line 67, in <module>
    command, channel = parse_bot_commands(slack_client.rtm_read())

AttributeError: 'WebClient' object has no attribute 'rtm_read'

I've tried reinstalling and instaling slack client as suggested in the first 5 google searches but still having the same issue. My slackclient==2.5.0 and my slack_client = slack.WebClient(token=slack_token).

Any ideas where does the problem lie? Thank you for your suggestions.

0 Answers
Related