mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-06-27 17:22:42 +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 {AutocompleteInteraction, ChatInputCommandInteraction} from 'discord.js';
|
||||||
import {URL} from 'url';
|
import {URL} from 'url';
|
||||||
import {SlashCommandBuilder} from '@discordjs/builders';
|
import {SlashCommandBuilder, SlashCommandSubcommandsOnlyBuilder} from '@discordjs/builders';
|
||||||
import {inject, injectable, optional} from 'inversify';
|
import {inject, injectable, optional} from 'inversify';
|
||||||
import Spotify from 'spotify-web-api-node';
|
import Spotify from 'spotify-web-api-node';
|
||||||
import Command from './index.js';
|
import Command from './index.js';
|
||||||
|
@ -13,12 +13,29 @@ import AddQueryToQueue from '../services/add-query-to-queue.js';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export default class implements Command {
|
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')
|
.setName('play')
|
||||||
.setDescription('play a song')
|
.setDescription('play a song')
|
||||||
.addStringOption(option => option
|
.addStringOption(option => option
|
||||||
.setName('query')
|
.setName('query')
|
||||||
.setDescription('YouTube URL, Spotify URL, or search query')
|
.setDescription(queryDescription)
|
||||||
.setAutocomplete(true)
|
.setAutocomplete(true)
|
||||||
.setRequired(true))
|
.setRequired(true))
|
||||||
.addBooleanOption(option => option
|
.addBooleanOption(option => option
|
||||||
|
@ -33,17 +50,6 @@ export default class implements Command {
|
||||||
.addBooleanOption(option => option
|
.addBooleanOption(option => option
|
||||||
.setName('skip')
|
.setName('skip')
|
||||||
.setDescription('skip the currently playing track'));
|
.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> {
|
public async execute(interaction: ChatInputCommandInteraction): Promise<void> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue