mattmakai / slack-starterbot

Python-powered simple starter Slack bot.
https://www.fullstackpython.com/blog/build-first-slack-bot-python.html
MIT License
197 stars 146 forks source link

slack_client.api_call -> slackclient.api_call #4

Open dopatraman opened 7 years ago

dopatraman commented 7 years ago

this

    slack_client.api_call("chat.postMessage", channel=channel,
                          text=response, as_user=True)

should be

    slackclient.api_call("chat.postMessage", channel=channel,
                          text=response, as_user=True)

right?

SteveChristian70 commented 7 years ago

@dopatraman Technically No, using slackclient.api_call is not correct for this case. If you look at line 14 we set the slack_client variable to SlackClient(os.environ.get('SLACK_BOT_TOKEN')) So then when we call that variable you would use slack_client.api_call because that is the variable name we assigned on line 14. As you probably know you can assign almost any name to a variable, so if you had set the variable name to sc you would call that variable using sc.



sc.api_call("chat.postMessage", channel=channel,
                          text=response, as_user=True)```