aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorsofushn <[email protected]>2024-09-07 13:09:45 +0200
committersofushn <[email protected]>2024-09-07 13:09:45 +0200
commitaf639159d1647ffb7b4c5c5f7ad035fe8766b6dc (patch)
tree5cd5de1d9cc6618ba0b056ab3f005ea21ac4007d /src/commands
parent534d8fafaa7f09f7ba940d044b08e6c48f800c7a (diff)
downloadmuse-af639159d1647ffb7b4c5c5f7ad035fe8766b6dc.tar.xz
muse-af639159d1647ffb7b4c5c5f7ad035fe8766b6dc.zip
feat: allow running without spotify
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/play.ts8
1 files changed, 4 insertions, 4 deletions
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;
}