From af639159d1647ffb7b4c5c5f7ad035fe8766b6dc Mon Sep 17 00:00:00 2001 From: sofushn Date: Sat, 7 Sep 2024 13:09:45 +0200 Subject: feat: allow running without spotify --- src/commands/play.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/commands') diff --git a/src/commands/play.ts b/src/commands/play.ts index 25aef1c..7851eb7 100644 --- a/src/commands/play.ts +++ b/src/commands/play.ts @@ -1,7 +1,7 @@ import {AutocompleteInteraction, ChatInputCommandInteraction} from 'discord.js'; import {URL} from 'url'; import {SlashCommandBuilder} from '@discordjs/builders'; -import {inject, injectable} from 'inversify'; +import {inject, injectable, optional} from 'inversify'; import Spotify from 'spotify-web-api-node'; import Command from './index.js'; import {TYPES} from '../types.js'; @@ -36,12 +36,12 @@ export default class implements Command { public requiresVC = true; - private readonly spotify: Spotify; + private readonly spotify?: Spotify; private readonly cache: KeyValueCacheProvider; private readonly addQueryToQueue: AddQueryToQueue; - constructor(@inject(TYPES.ThirdParty) thirdParty: ThirdParty, @inject(TYPES.KeyValueCache) cache: KeyValueCacheProvider, @inject(TYPES.Services.AddQueryToQueue) addQueryToQueue: AddQueryToQueue) { - this.spotify = thirdParty.spotify; + constructor(@inject(TYPES.ThirdParty) @optional() thirdParty: ThirdParty, @inject(TYPES.KeyValueCache) cache: KeyValueCacheProvider, @inject(TYPES.Services.AddQueryToQueue) addQueryToQueue: AddQueryToQueue) { + this.spotify = thirdParty?.spotify; this.cache = cache; this.addQueryToQueue = addQueryToQueue; } -- cgit v1.2.3