Skip to content

Commit

Permalink
Add documentation for eligible function
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraiSubject committed Apr 1, 2023
1 parent 9ee4cb8 commit fc7704f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,33 @@ export const config: ITournamentConfig = {
}
```

You can also modify the `isUserEligible` function to customise it according to your needs. The function just has to return a boolean for the condition where a user is eligible.

The default implementation that we use for verification on the osu! Tournament Hub:
https://github.com/MiraiSubject/cosette-lite/blob/9ee4cb86f20debf4e2e7f86e9d52f5610408fe5e/packages/config/config.ts#L21-L34

**Note: By default the `OsuUser` in the parameter uses their favourite game mode.**

To modify it to use your desired game mode `./apps/webstack/src/routes/auth/osu/callback/+server.ts` [this file](https://github.com/MiraiSubject/cosette-lite/blob/master/apps/webstack/src/routes/auth/osu/callback/%2Bserver.ts) to match the game mode.

Currently the valid modes according to the current osu! [API documentation](https://osu.ppy.sh/docs/index.html#gamemode) are:
- `fruits` for osu!catch
- `mania` for osu!mania
- `osu` for osu!standard
- `taiko` for osu!taiko

Here is how you would modify the function to get the user's data for the appropriate game mode:
```diff
async function getUserData(tokens: {
access_token: string;
token_type: string;
}) {
- const url = 'https://osu.ppy.sh/api/v2/me';
+ const url = 'https://osu.ppy.sh/api/v2/me/osu';
// ...
}
```

## Developing

Install dependencies:
Expand Down

0 comments on commit fc7704f

Please sign in to comment.