Skip to content

function ban

Note

The reason string can't be longer than 255 characters.

This function will ban the player on the server.
Original: ban

Declaration

async def ban(id : int, minutes : int, reason : str)

Parameters

int id: the player id.
int minutes: the time how long ban will take in minutes. Passing 0 will cause the player to have permanent ban.
str reason: the reason why player was banned.

Source code in src/pyg2o/functions/player.py
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
async def ban(id : int, minutes : int, reason : str):
    """
    !!! note
        The reason string can't be longer than 255 characters.
    This function will ban the player on the server.
    Original: [ban](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/server-functions/player/ban/)

    ## Declaration
    ```python
    async def ban(id : int, minutes : int, reason : str)
    ```
    ## Parameters
    `int` **id**: the player id.
    `int` **minutes**: the time how long ban will take in minutes. Passing `0` will cause the player to have permanent ban.
    `str` **reason**: the reason why player was banned.
    """
    data = f'return {get_call_repr()}'

    server = await PythonWebsocketServer.get_server()
    result = await server.make_request(data)
    return result