Handle osu! command when the module is not initialized

This commit is contained in:
Mint
2022-11-13 19:31:17 +09:00
parent b88ead6d93
commit 684b64985f
3 changed files with 32 additions and 44 deletions
+4
View File
@@ -39,6 +39,10 @@ class App {
}
public load_osu(): void {
if (!Environment.get().OSU_API_KEY) {
Logger.log('warn', 'OSU_API_KEY is not defined in .env, osu! features will be disabled');
return;
}
Logger.log('info', 'Loading osu! Client');
osu.init();
}
+2 -6
View File
@@ -2,14 +2,10 @@ import { Api } from 'node-osu';
import Environment from './Environment';
class osuAPI {
public client: Api;
public client: Api | null;
constructor() {
this.client = new Api(Environment.get().OSU_API_KEY, {
notFoundAsError: false,
completeScores: true,
parseNumeric: true
});
this.client = null;
}
public init(): void {