feat: Added docs via MkDocs

This commit is contained in:
AURUMVORXX
2024-11-04 05:09:59 +03:00
parent 810dd00dd8
commit 6a20d96bb5
21 changed files with 299 additions and 63 deletions

View File

@@ -0,0 +1,27 @@
# `event` onBan
!!! note
If serial/mac/ip/name indexes doesn't exist, then the parameters has not been specified when ban was added.
If timestamp doesn't exist, then ban was permanent.
This event is triggered when new ban is being added.
## Parameters
* `dict` **kwargs**:
* `str` **mac**: MAC address of the banned player.
* `str` **ip**: IP address of the banned player.
* `str` **serial**: serial of the banned player.
* `str` **name**: nickname of the banned player.
* `int` **timestamp**: timestamp when the ban expires.
## Usage
```python
import g2o
from datetime import datetime
@g2o.event('onBan')
def onBan(**kwargs):
print(f'Player {kwargs['name']} has been banned.')
if ('timestamp' in kwargs):
banExpires = datetime.fromtimestamp(kwargs['timestamp'])
print(f'Ban expires at {banExpires}')
```