diff --git a/src/server/shared/twitch/twitch.ts b/src/server/shared/twitch/twitch.ts index 3a7dbd183b..ea3cabb302 100644 --- a/src/server/shared/twitch/twitch.ts +++ b/src/server/shared/twitch/twitch.ts @@ -14,6 +14,12 @@ export interface TwitchBot { getChannel: (channel: string) => Promise; } +export class DisabledTwitchBot implements TwitchBot { + async getChannel(_channel: string): Promise { + return undefined; + } +} + export class TwitchBotImpl implements TwitchBot { private accessToken: string | undefined; private expiresAt: number | undefined; @@ -99,6 +105,9 @@ export class TwitchBotImpl implements TwitchBot { export async function registerTwitchBot( _loader: RegistryLoader ): Promise { + if (process.env.NOVE_ENV !== "production" && !process.env.ALLOW_DEV_TWITCH) { + return new DisabledTwitchBot(); + } const bot = new TwitchBotImpl(); await bot.login(); return bot;