def test_get_user(slack_client):
    from hubcommander.bot_components.slack_comm import get_user_data
    result, error = get_user_data({"user": "******"})
    assert not error
    assert result["name"] == "hcommander"

    result, error = get_user_data({"user": "******"})
    assert not result
    assert error
def process_the_command(data, command_prefix):
    """
    Will perform all command_plugins duties if a command_plugins arrived.

    :param data:
    :param command_prefix:
    :return:
    """
    # Reach out to slack to get the user's information:
    user_data, error = get_user_data(data)
    if error:
        send_error(data["channel"], "ERROR: Unable to communicate with the Slack API. Error:\n{}".format(error))
        return

    # Execute the message:
    if COMMANDS[command_prefix]["user_data_required"]:
        COMMANDS[command_prefix]["func"](data, user_data)

    else:
        COMMANDS[command_prefix]["func"](data)
Beispiel #3
0
def process_the_command(data, command_prefix):
    """
    Will perform all command_plugins duties if a command_plugins arrived.

    :param data:
    :param command_prefix:
    :return:
    """
    # Reach out to slack to get the user's information:
    user_data, error = get_user_data(data)
    if error:
        send_error(
            data["channel"],
            "ERROR: Unable to communicate with the Slack API. Error:\n{}".
            format(error))
        return

    # Execute the message:
    if COMMANDS[command_prefix]["user_data_required"]:
        COMMANDS[command_prefix]["func"](data, user_data)

    else:
        COMMANDS[command_prefix]["func"](data)