UNPKG

@halpz/fetch

Version:

discordbot commands using js

52 lines (45 loc) 1.49 kB
const { CommandInteraction, EmbedBuilder } = require('discord.js'); const { useQueue } = require('discord-player') module.exports = now_playing /** * * * @param {CommandInteraction} interaction */ async function now_playing(client, interaction) { const queue = useQueue(interaction.guildId); if (queue) { return [ new EmbedBuilder() .setTitle(`Now playing:`) .setColor(client.get_color()) .setThumbnail(queue.currentTrack.thumbnail) .addFields([ { name: `Title:`, value: `${queue.currentTrack.title}`, }, { name: `Author:`, value: `${queue.currentTrack.author}` }, { name: `Now timestamp:`, value: `${queue.node.getTimestamp().current.label} / ${queue.node.getTimestamp().total.label}` } ]) ] } else { return [ new EmbedBuilder() .setColor(client.get_color()) .addFields([ { name: `I can't get current track`, value: `Error: I'm not playing anything now`, }, ]) ] } }