Api for scheduling and managing Dota 2 matches.
- need to have .env file in main
d2apiwith below format - need to have inventory.json in main
d2apifolder with credentials, 2FA should be disabled for all accounts, one account should be enough for testing - need to have REDIS instance, either local or remote
- go 1.21 or higher
Optional:
- Docker and docker-compose for running redis and server in containers
REDIS_PASSWORD=
REDIS_HOST=
REDIS_PORT=
REDIS_DB=
SERVER_PORT=
INVENTORY_PATH=
TIME_TO_CANCEL= //Time to cancel in seconds
[
{
"Username": "", // Username of steam account
"Password": "" // Password of steam account
}
]
# Start redis inside docker container
$ docker compose up redis -d
# Run the server
$ go run /cmd/main.goIf you have docker compose version 1.22 or higher
# Start both server and redis inside docker container
$ docker compose watchDocker compose watch is setup so that any changes in the code will automatically rebuild the server, effectively giving you a hot reload.
# Start both server and redis inside docker container
$ docker compose up -dThis endpoint schedules a match.
{
"teamA": [],
"teamB": [],
"lobbyConfig": {
"gameName": "",
"passKey": "",
"serverRegion": 0,
"gameMode": ""
},
"startTime": ""
}- teamA: Array of Steam IDs for Team A.
- teamB: Array of Steam IDs for Team B.
- lobbyConfig:
- gameName: Lobby name, send as string.
- passKey: Password for the lobby, send as string, this is required so lobby is shown as public.
- serverRegion: Server region of the match, send as number.
- gameMode: Game mode of the match, send as string, see Game Mode List below.
- startTime: Start time of the match, format:
"2021-07-01T12:00:00Z", if not provided, match will be scheduled immediately.
returns 200 if match is scheduled successfully, 400 if match is not scheduled.
{
"matchIdx": 0
}This endpoint returns the match details for the given match index matchIdx.
Keep in mind that match index is returned when a match is scheduled.
If match is not begun it will return lobby details, and match details can be fetched only when the match is finished.
It will either return lobby details or match details based on the match status.
returns 200 if match is found, 404 if match is not found.
- AP: All Pick
- CM: Captain Mode
- RD: Random Draft
- SD: Single Draft
- AR: All Random
- REVERSE_CM: Reverse Captain Mode
- MO: Mid Only
- LP: Least played
- CD: Captains Draft
- ABILITY_DRAFT: Ability Draft
- ARDM: All Random Deathmatch
- 1V1MID: 1v1 Solo Mid
- ALL_DRAFT: Ranked All Pick
- TURBO: Turbo