import requests


def get_slack_bot_id(slack_bot_user_token):
    """Gets the bots user id, mainly used so it won't talk to itself"""

    url = "https://slack.com/api/auth.test"
    headers = {'Authorization': 'Bearer ' + slack_bot_user_token}
    response = requests.request("POST", url, headers=headers)

    data = response.json()

    if "user_id" in data:
        return data["user_id"]
    else:
        raise Exception("Unable to authorize app with slack using user access token. Check that Bot User OAuth Access Token matches SLACK_BOT_USER_TOKEN in .env file.")

    return None