Compare commits

..

2 commits

Author SHA1 Message Date
e7abbd6012
Update README.md 2024-09-05 04:18:36 +01:00
143898753e
Move config to root 2024-09-05 03:57:46 +01:00
3 changed files with 32 additions and 5 deletions

4
.gitignore vendored
View file

@ -39,8 +39,8 @@ build/
.DS_Store .DS_Store
### Other Stuff ### ### Other Stuff ###
**/resources/config*.json config*.json
!**/resources/config.example.json config.example.json
!**/resources/config.schema.json !**/resources/config.schema.json
### why would this not be here already ### ### why would this not be here already ###

View file

@ -9,3 +9,31 @@ A multipurpose Discord bot written in Java.
### Tested Operating Systems ### Tested Operating Systems
- macOS 14.4.1 - macOS 14.4.1
- Windows 10 (22H2) - Windows 10 (22H2)
---
## Config file schema
```json
{
"token": "your_token",
"prefix": "oki!",
"mariadb": {
"host": "127.0.0.1",
"user": "db_user",
"password": "db_password",
"database": "doki_prod"
}
}
```
---
## Commands
| Command | Description | Arguments | Aliases |
|---------------|------------------------------------------------------------------------------|---------------|---------|
| `leaderboard` | Gets the leaderboard for the current guild | None | `lb` |
| `rank` | Gets the rank of the specified user (message author if none specified) | `[user ping]` | None |
| `about` | Gets information about the bot | None | None |
| `ping` | Gets the bot's gateway & rest ping | None | None |
| `whois` | Gets information about the specified user (message author if none specified) | `[user ping]` | None |

View file

@ -22,8 +22,7 @@ public class Config {
*/ */
public static Config readConfig() throws IOException { public static Config readConfig() throws IOException {
Logger log = Logging.getLogger(); Logger log = Logging.getLogger();
try (InputStream in=Thread.currentThread().getContextClassLoader().getResourceAsStream("config.json")) { try (InputStream in = new FileInputStream("./config.json")) {
assert in != null;
Reader reader = new InputStreamReader(in, StandardCharsets.UTF_8); Reader reader = new InputStreamReader(in, StandardCharsets.UTF_8);
log.info("Loaded config"); log.info("Loaded config");
return new Gson().fromJson(reader, Config.class); return new Gson().fromJson(reader, Config.class);