Management Scripts
There are several server-side scripts that allow you to manage the app and add initial data.
All these scripts support the --help
command that gives more details on how they work.
The paths mentioned here are relative to the project root (/opt/miniapps.example.com
on the installation guide).
If you want to run these on the docker instance, they should be invoked like this:
docker-compose exec miniapp server/list_users.py
If you want to run them directly, you need to ensure you have Python
and the pip requirements from server/requirements.txt
installed.
Please note that the installation guide uses SQLite to minimize set up, so you might need to restart the server after changing data on the database.
server/add_event.py
Adds an event to the database
usage: server/add_event.py [-h] --title TITLE --description DESCRIPTION
--image IMAGE --start START --duration DURATION
Named Arguments
- --title, -t
Event title
- --description, -d
Event description
- --image, -i
Image path. It will be copied over to the media directory. Note that images should be less than 512 KB in size, have a 16:9 aspect ratio and should be at least 400 pixels wide.
- --start, -s
Start time, in HH:MM format
- --duration, -r
Number of hours the event lasts for
server/list_users.py
Shows a list of users, with their telegram ID, admin status and name
usage: server/list_users.py [-h]
server/make_admin.py
Makes a user an admin.
If the user doesn’t exist in the database, it will be created.
You can use server/list_users.py
to find the right telegram ID.
usage: server/make_admin.py [-h] telegram_id
Positional Arguments
- telegram_id
server/server.py
Runs the server
usage: server/server.py [-h] [--host HOST] [--port PORT] [--reload]
[--no-reload]
Named Arguments
- --host
Websocket bind address
Default: “localhost”
- --port, -p, -P
Websocket port
Default: 2536
- --reload, -r
If present, auto-reloads the server when sources change
Default: False
- --no-reload, -nr
If present disables auto-reloading
Default: False
server/websocket_client.py
Manually sends websocket data
usage: server/websocket_client.py [-h] [url]
Positional Arguments
- url
Websocket URL
Default: “ws://localhost:2536/”