Updated music commands
This commit is contained in:
@@ -10,25 +10,27 @@ export default async function nowplaying(interaction: ChatInputCommandInteractio
|
||||
|
||||
if (!queue) {
|
||||
await interaction.editReply({
|
||||
content: "There is no queue"
|
||||
embeds: [{
|
||||
description: "There is no music playing",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const current = queue.currentTrack
|
||||
|
||||
if (!current) {
|
||||
await interaction.editReply({
|
||||
content: "There is no current song"
|
||||
embeds: [{
|
||||
description: "There is no music playing",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
author: {
|
||||
name: current.author,
|
||||
},
|
||||
title: "Now Playing",
|
||||
description: `[${current.title}](${current.url})`,
|
||||
color: embedColor,
|
||||
|
||||
38
src/commands/music/pause.ts
Normal file
38
src/commands/music/pause.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { embedColor } from "config/options"
|
||||
import { useMainPlayer } from "discord-player"
|
||||
import { ChatInputCommandInteraction } from "discord.js"
|
||||
|
||||
export default async function pause(interaction: ChatInputCommandInteraction) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const player = useMainPlayer()
|
||||
const queue = player.queues.get(interaction.guildId!)
|
||||
|
||||
if (!queue) {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "There is no music playing",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (queue.node.isPaused()) {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "The music is already paused",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
queue.node.setPaused(true)
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Paused the music",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
@@ -18,6 +18,8 @@ export default async function play(interaction: ChatInputCommandInteraction) {
|
||||
return
|
||||
}
|
||||
|
||||
// const bitRate = channel.bitrate / 1000
|
||||
|
||||
const { track } = await player.play(channel, query, {
|
||||
requestedBy: interaction.user,
|
||||
nodeOptions: {
|
||||
|
||||
@@ -8,7 +8,12 @@ export default async function queue(interaction: ChatInputCommandInteraction) {
|
||||
const queue = player.queues.get(interaction.guildId!)
|
||||
|
||||
if (!queue) {
|
||||
await interaction.editReply("There is nothing playing")
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "There is no queue",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -20,8 +25,15 @@ export default async function queue(interaction: ChatInputCommandInteraction) {
|
||||
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
title: "Queue",
|
||||
description: nowPlaying + "\n\n" + tracks.join("\n"),
|
||||
color: embedColor
|
||||
thumbnail: {
|
||||
url: currentSong?.thumbnail || ""
|
||||
},
|
||||
color: embedColor,
|
||||
footer: {
|
||||
text: `Total tracks: ${queue.tracks.size}`
|
||||
}
|
||||
}]
|
||||
})
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import { embedColor } from "config/options"
|
||||
import { useMainPlayer } from "discord-player"
|
||||
import { ChatInputCommandInteraction } from "discord.js"
|
||||
|
||||
@@ -10,14 +11,20 @@ export default async function skip(interaction: ChatInputCommandInteraction) {
|
||||
|
||||
if (!queue) {
|
||||
await interaction.editReply({
|
||||
content: "There is no queue"
|
||||
embeds: [{
|
||||
description: "There is no queue",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (amount > queue.size) {
|
||||
await interaction.editReply({
|
||||
content: `There are only ${queue.size} songs in the queue`
|
||||
embeds: [{
|
||||
description: `There are only ${queue.size} song${queue.size === 1 ? "" : "s"} in the queue`,
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -29,6 +36,9 @@ export default async function skip(interaction: ChatInputCommandInteraction) {
|
||||
}
|
||||
|
||||
await interaction.editReply({
|
||||
content: `Skipped ${amount} song${amount === 1 ? "" : "s"}`
|
||||
embeds: [{
|
||||
description: `Skipped ${amount === 1 ? "1 song" : `${amount} songs`}`,
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
38
src/commands/music/unpause.ts
Normal file
38
src/commands/music/unpause.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { embedColor } from "config/options"
|
||||
import { useMainPlayer } from "discord-player"
|
||||
import { ChatInputCommandInteraction } from "discord.js"
|
||||
|
||||
export default async function pause(interaction: ChatInputCommandInteraction) {
|
||||
await interaction.deferReply()
|
||||
|
||||
const player = useMainPlayer()
|
||||
const queue = player.queues.get(interaction.guildId!)
|
||||
|
||||
if (!queue) {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "There is no music playing",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (!queue.node.isPaused()) {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "The music is not paused",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
queue.node.setPaused(false)
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "Unpaused the music",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
@@ -11,7 +11,10 @@ export default async function volume(interaction: ChatInputCommandInteraction) {
|
||||
|
||||
if (!queue) {
|
||||
await interaction.editReply({
|
||||
content: "There is no queue"
|
||||
embeds: [{
|
||||
description: "There is no music playing",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user