This function will get the hostname of the server.
Original: getHostname
Declaration
async def getHostname() -> str
Returns
str: Server hostname.
Usage
import g2o
@g2o.event('onInit')
def evtInit(**kwargs):
print('Server hostname:', g2o.getHostname())
Source code in src/pyg2o/functions/game.py
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 | async def getHostname() -> str:
"""
This function will get the hostname of the server.
Original: [getHostname](https://gothicmultiplayerteam.gitlab.io/docs/0.3.0/script-reference/shared-functions/game/getHostname/)
## Declaration
```python
async def getHostname() -> str
```
## Returns
`str`: Server hostname.
## Usage
```python
import g2o
@g2o.event('onInit')
def evtInit(**kwargs):
print('Server hostname:', g2o.getHostname())
```
"""
data = f'return {get_call_repr()}'
server = await PythonWebsocketServer.get_server()
result = await server.make_request(data)
return result
|