def remove_management_role(guild_id, management_role):
    response = handler.handle_lambda(
        make_discord_admin_remove_role_event(guild_id=guild_id,
                                             management_role=management_role,
                                             is_admin=True), create_context())

    assert response['statusCode'] == 200
    return json.loads(response['body'])
def manage_list_games(guild_id, channel_id, role_id) -> dict:
    response = handler.handle_lambda(
        make_discord_manage_list_event(guild_id=guild_id,
                                       channel_id=channel_id,
                                       role_id=role_id), create_context())

    assert response['statusCode'] == 200
    return json.loads(response['body'])
Пример #3
0
def post_channel_message(guild_id: int, game_id: str, channel_id: int):
    response = handler.handle_lambda(
        make_discord_manage_post_event(guild_id=guild_id,
                                       game_id=game_id,
                                       channel_id=channel_id),
        create_context())

    assert response['statusCode'] == 200
Пример #4
0
def guess_on_game(guild_id: int, game_id: str, guess: str, user_id: int):
    response = handler.handle_lambda(
        make_discord_guess_event(guild_id=guild_id,
                                 game_id=game_id,
                                 guess=guess,
                                 user_id=user_id), create_context())

    assert response['statusCode'] == 200
def admin_info(guild_id: int, channel_id: int, role_id: int, is_admin: bool):
    response = handler.handle_lambda(
        make_discord_admin_info(guild_id=guild_id,
                                channel_id=channel_id,
                                role_id=role_id,
                                is_admin=is_admin), create_context())

    assert response['statusCode'] == 200
    return json.loads(response['body'])
def add_management_channel(guild_id, channel_id):
    response = handler.handle_lambda(
        make_discord_admin_add_channel_event(
            guild_id=guild_id,
            new_management_channel_id=channel_id,
            is_admin=True), create_context())

    assert response['statusCode'] == 200
    return json.loads(response['body'])
Пример #7
0
def delete_guess(guild_id: int, game_id: str, guessing_user_id: int,
                 channel_id: int):
    response = handler.handle_lambda(
        make_discord_delete_guess_event(guild_id=guild_id,
                                        game_id=game_id,
                                        member=guessing_user_id,
                                        channel_id=channel_id),
        create_context())

    assert response['statusCode'] == 200
Пример #8
0
def create_new_game(guild_id: int, game_id: str, title: str, description: str,
                    channel_id: int, min_guess: int, max_guess: int):
    response = handler.handle_lambda(
        make_discord_create_event(
            guild_id=guild_id,
            game_id=game_id,
            game_title=title,
            game_description=description,
            channel_id=channel_id,
            min_guess=min_guess,
            max_guess=max_guess,
        ), create_context())

    assert response['statusCode'] == 200
def test_ping():
    # Given
    event = {
        'body': json.dumps({
            "id": "00000001",
            "token": "some-token-abcde1234567890",
            "type": InteractionType.PING,
            "version": 1
        }),
        'headers': {},
    }

    # When
    response = handler.handle_lambda(event, {})

    # Then
    assert response['statusCode'] == 200
    assert response['headers']['Content-Type'] == 'application/json'
    assert json.loads(response['body']) == {'type': 1}