Skip to content

Commit fc7704f

Browse files
committed
Add documentation for eligible function
1 parent 9ee4cb8 commit fc7704f

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,33 @@ export const config: ITournamentConfig = {
9090
}
9191
```
9292

93+
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.
94+
95+
The default implementation that we use for verification on the osu! Tournament Hub:
96+
https://github.com/MiraiSubject/cosette-lite/blob/9ee4cb86f20debf4e2e7f86e9d52f5610408fe5e/packages/config/config.ts#L21-L34
97+
98+
**Note: By default the `OsuUser` in the parameter uses their favourite game mode.**
99+
100+
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.
101+
102+
Currently the valid modes according to the current osu! [API documentation](https://osu.ppy.sh/docs/index.html#gamemode) are:
103+
- `fruits` for osu!catch
104+
- `mania` for osu!mania
105+
- `osu` for osu!standard
106+
- `taiko` for osu!taiko
107+
108+
Here is how you would modify the function to get the user's data for the appropriate game mode:
109+
```diff
110+
async function getUserData(tokens: {
111+
access_token: string;
112+
token_type: string;
113+
}) {
114+
- const url = 'https://osu.ppy.sh/api/v2/me';
115+
+ const url = 'https://osu.ppy.sh/api/v2/me/osu';
116+
// ...
117+
}
118+
```
119+
93120
## Developing
94121

95122
Install dependencies:

0 commit comments

Comments
 (0)