Added now playing
This commit is contained in:
@@ -5,6 +5,7 @@ import leave from "./music/leave"
|
|||||||
import queue from "./music/queue"
|
import queue from "./music/queue"
|
||||||
import volume from "./music/volume"
|
import volume from "./music/volume"
|
||||||
import skip from "./music/skip"
|
import skip from "./music/skip"
|
||||||
|
import nowplaying from "./music/nowplaying"
|
||||||
|
|
||||||
export = {
|
export = {
|
||||||
name: "music",
|
name: "music",
|
||||||
@@ -49,6 +50,10 @@ export = {
|
|||||||
subcommand
|
subcommand
|
||||||
.setName("queue")
|
.setName("queue")
|
||||||
.setDescription("Show the queue"))
|
.setDescription("Show the queue"))
|
||||||
|
.addSubcommand(subcommand =>
|
||||||
|
subcommand
|
||||||
|
.setName("nowplaying")
|
||||||
|
.setDescription("Show the currently playing song"))
|
||||||
.addSubcommand(subcommand =>
|
.addSubcommand(subcommand =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName("leave")
|
.setName("leave")
|
||||||
@@ -79,6 +84,11 @@ export = {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (subcommand === "nowplaying") {
|
||||||
|
nowplaying(interaction)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (subcommand === "leave") {
|
if (subcommand === "leave") {
|
||||||
leave(interaction)
|
leave(interaction)
|
||||||
return
|
return
|
||||||
|
|||||||
43
src/commands/music/nowplaying.ts
Normal file
43
src/commands/music/nowplaying.ts
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
import { embedColor } from "config/options"
|
||||||
|
import { useMainPlayer } from "discord-player"
|
||||||
|
import { ChatInputCommandInteraction } from "discord.js"
|
||||||
|
|
||||||
|
export default async function nowplaying(interaction: ChatInputCommandInteraction) {
|
||||||
|
await interaction.deferReply()
|
||||||
|
|
||||||
|
const player = useMainPlayer()
|
||||||
|
const queue = player.queues.get(interaction.guildId!)
|
||||||
|
|
||||||
|
if (!queue) {
|
||||||
|
await interaction.editReply({
|
||||||
|
content: "There is no queue"
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const current = queue.currentTrack
|
||||||
|
|
||||||
|
if (!current) {
|
||||||
|
await interaction.editReply({
|
||||||
|
content: "There is no current song"
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
await interaction.editReply({
|
||||||
|
embeds: [{
|
||||||
|
author: {
|
||||||
|
name: current.author,
|
||||||
|
},
|
||||||
|
title: "Now Playing",
|
||||||
|
description: `[${current.title}](${current.url})`,
|
||||||
|
color: embedColor,
|
||||||
|
thumbnail: {
|
||||||
|
url: current.thumbnail
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
text: `Requested by ${current.requestedBy!.username} | ${current.duration}`
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user