Help about music bot

Hello I'm making a music bot. I;m using Discord-Player package. Problem is i want to make everything is one command,i mean
/play <URL | KEYWORDS | PLAYLIST URL>
/play <URL | KEYWORDS | PLAYLIST URL>
Is it possible to make it? Because on internet i just see i can make it but with subcommands so
/play <KEYWORDS>
/play <URL OF PLAYLIST>
/play <URL OF SONG>
/play <KEYWORDS>
/play <URL OF PLAYLIST>
/play <URL OF SONG>
4 Replies
Unknown User
Unknown Userā€¢2y ago
Message Not Public
Sign In & Join Server To View
Perodix__
Perodix__OPā€¢2y ago
if(interaction.options.getSubcommand() === "song") {
let url = interaction.options.getString("url")
const result = await client.player.search(url, {
requestedBy: interaction.user,
searchEngine: QueryType.AUTO
})
if (result.tracks.length === 0)
return interaction.editReply("No results")

const song = result.tracks[0]
await queue.addTrack(song)
embed
.setDescription(`**[${song.title}](${song.url})** has been added to the Queue`)
.setThumbnail(song.thumbnail)
.setFooter({ text: `Duration: ${song.duration}`})
if(interaction.options.getSubcommand() === "song") {
let url = interaction.options.getString("url")
const result = await client.player.search(url, {
requestedBy: interaction.user,
searchEngine: QueryType.AUTO
})
if (result.tracks.length === 0)
return interaction.editReply("No results")

const song = result.tracks[0]
await queue.addTrack(song)
embed
.setDescription(`**[${song.title}](${song.url})** has been added to the Queue`)
.setThumbnail(song.thumbnail)
.setFooter({ text: `Duration: ${song.duration}`})
Yes try to look at code myb you better understand how it works What this do
searchEngine: QueryType.AUTO
searchEngine: QueryType.AUTO
d.js docs
d.js docsā€¢2y ago
We do not provide any help with third party libraries Buttons and Modals are supported natively. ā€¢ Buttons: learn more ā€¢ Modals: learn more
Perodix__
Perodix__OPā€¢2y ago
Idk haha,but ig is like AUTO Automatic yes but myb you k šŸ™‚ i found solution tnxx šŸ™‚
Want results from more Discord servers?
Add your server