mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-06-27 09:12:43 +02:00
fix: Spotify URL is part of query description even when disabled
This commit is contained in:
parent
107464e222
commit
66e022489f
1 changed files with 27 additions and 21 deletions
|
@ -1,6 +1,6 @@
|
|||
import {AutocompleteInteraction, ChatInputCommandInteraction} from 'discord.js';
|
||||
import {URL} from 'url';
|
||||
import {SlashCommandBuilder} from '@discordjs/builders';
|
||||
import {SlashCommandBuilder, SlashCommandSubcommandsOnlyBuilder} from '@discordjs/builders';
|
||||
import {inject, injectable, optional} from 'inversify';
|
||||
import Spotify from 'spotify-web-api-node';
|
||||
import Command from './index.js';
|
||||
|
@ -13,12 +13,29 @@ import AddQueryToQueue from '../services/add-query-to-queue.js';
|
|||
|
||||
@injectable()
|
||||
export default class implements Command {
|
||||
public readonly slashCommand = new SlashCommandBuilder()
|
||||
public readonly slashCommand: Partial<SlashCommandBuilder | SlashCommandSubcommandsOnlyBuilder> & Pick<SlashCommandBuilder, 'toJSON'>;
|
||||
|
||||
public requiresVC = true;
|
||||
|
||||
private readonly spotify?: Spotify;
|
||||
private readonly cache: KeyValueCacheProvider;
|
||||
private readonly addQueryToQueue: AddQueryToQueue;
|
||||
|
||||
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;
|
||||
|
||||
const queryDescription = thirdParty === undefined
|
||||
? 'YouTube URL or search query'
|
||||
: 'YouTube URL, Spotify URL, or search query';
|
||||
|
||||
this.slashCommand = new SlashCommandBuilder()
|
||||
.setName('play')
|
||||
.setDescription('play a song')
|
||||
.addStringOption(option => option
|
||||
.setName('query')
|
||||
.setDescription('YouTube URL, Spotify URL, or search query')
|
||||
.setDescription(queryDescription)
|
||||
.setAutocomplete(true)
|
||||
.setRequired(true))
|
||||
.addBooleanOption(option => option
|
||||
|
@ -33,17 +50,6 @@ export default class implements Command {
|
|||
.addBooleanOption(option => option
|
||||
.setName('skip')
|
||||
.setDescription('skip the currently playing track'));
|
||||
|
||||
public requiresVC = true;
|
||||
|
||||
private readonly spotify?: Spotify;
|
||||
private readonly cache: KeyValueCacheProvider;
|
||||
private readonly addQueryToQueue: AddQueryToQueue;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public async execute(interaction: ChatInputCommandInteraction): Promise<void> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue