mirror of
https://github.com/tribufu/sdk-js
synced 2025-06-16 18:44:18 +00:00
Fix circular dep
This commit is contained in:
@ -43,14 +43,15 @@ export class TribufuBot extends TribufuApi {
|
||||
* @example
|
||||
* ```ts
|
||||
* // process.env.TRIBUFU_BOT_TOKEN
|
||||
* const bot = TribufuBot.fromEnv("TRIBUFU_");
|
||||
* const bot = TribufuBot.fromEnv("TRIBUFU");
|
||||
* ```
|
||||
*/
|
||||
public static override fromEnv(prefix: string = ""): TribufuBot | null {
|
||||
const token = process.env[`${prefix}BOT_TOKEN`];
|
||||
public static override fromEnv(prefix?: string | null): TribufuBot | null {
|
||||
const envPrefix = prefix ? `${prefix}_` : "";
|
||||
const token = process.env[`${envPrefix}BOT_TOKEN`];
|
||||
|
||||
if (token) {
|
||||
return TribufuApi.withBot(token);
|
||||
return new TribufuBot(token);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user