Updated music commands
This commit is contained in:
@@ -15,7 +15,6 @@ export default async function leave(interaction: ChatInputCommandInteraction) {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
queue.delete()
|
||||
await interaction.reply({
|
||||
embeds: [{
|
||||
|
||||
@@ -21,7 +21,7 @@ export default async function play(interaction: ChatInputCommandInteraction) {
|
||||
const { track } = await player.play(channel, query, {
|
||||
requestedBy: interaction.user,
|
||||
nodeOptions: {
|
||||
volume: 50,
|
||||
volume: 25,
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import { ChatInputCommandInteraction } from "discord.js"
|
||||
export default async function queue(interaction: ChatInputCommandInteraction) {
|
||||
await interaction.deferReply()
|
||||
const player = useMainPlayer()
|
||||
|
||||
const queue = player.queues.get(interaction.guildId!)
|
||||
|
||||
if (!queue) {
|
||||
@@ -14,9 +13,7 @@ export default async function queue(interaction: ChatInputCommandInteraction) {
|
||||
}
|
||||
|
||||
const currentSong = queue.currentTrack
|
||||
|
||||
const nowPlaying = `Now playing: [${currentSong?.title}](${currentSong?.url})`
|
||||
|
||||
const tracks = queue.tracks.map((track, index) => {
|
||||
return `${index + 1}. [${track.title}](${track.url})`
|
||||
})
|
||||
|
||||
34
src/commands/music/skip.ts
Normal file
34
src/commands/music/skip.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { useMainPlayer } from "discord-player"
|
||||
import { ChatInputCommandInteraction } from "discord.js"
|
||||
|
||||
export default async function skip(interaction: ChatInputCommandInteraction) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const amount = interaction.options.getNumber("amount") ?? 1
|
||||
const player = useMainPlayer()
|
||||
const queue = player.queues.get(interaction.guildId!)
|
||||
|
||||
if (!queue) {
|
||||
await interaction.editReply({
|
||||
content: "There is no queue"
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (amount > queue.size) {
|
||||
await interaction.editReply({
|
||||
content: `There are only ${queue.size} songs in the queue`
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (amount === 1) {
|
||||
queue.node.skip()
|
||||
} else {
|
||||
queue.node.skipTo(amount)
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
content: `Skipped ${amount} song${amount === 1 ? "" : "s"}`
|
||||
})
|
||||
}
|
||||
26
src/commands/music/volume.ts
Normal file
26
src/commands/music/volume.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { embedColor } from "config/options"
|
||||
import { useMainPlayer } from "discord-player"
|
||||
import { ChatInputCommandInteraction } from "discord.js"
|
||||
|
||||
export default async function volume(interaction: ChatInputCommandInteraction) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const volume = interaction.options.getNumber("volume")!
|
||||
const player = useMainPlayer()
|
||||
const queue = player.queues.get(interaction.guildId!)
|
||||
|
||||
if (!queue) {
|
||||
await interaction.editReply({
|
||||
content: "There is no queue"
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
queue.node.setVolume(volume)
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: `Volume set to ${volume}`,
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user