eximiabots-radiox/src/client/commands/nowplaying.js

35 lines
1.8 KiB
JavaScript
Raw Normal View History

2021-08-18 22:52:16 +00:00
const { SlashCommandBuilder } = require('@discordjs/builders');
2020-03-02 19:38:42 +00:00
module.exports = {
name: 'nowplaying',
alias: 'np',
usage: '',
2020-08-25 06:35:39 +00:00
description: 'Current Radio Station',
2020-03-02 19:38:42 +00:00
permission: 'none',
category: 'radio',
2021-08-18 22:52:16 +00:00
data: new SlashCommandBuilder()
.setName('nowplaying')
.setDescription('Current Radio Station'),
async execute(interaction, client, Discord, command) {
2020-03-12 22:53:23 +00:00
let message = {};
2021-08-18 22:52:16 +00:00
const radio = client.radio.get(interaction.guild.id);
if (!radio) return interaction.reply('There is nothing playing.');
if(!client.stations) {
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
2021-08-18 22:52:16 +00:00
return interaction.reply(client.messageEmojis["error"] + message.errorToGetPlaylist);
}
const completed = (radio.connection.dispatcher.streamTime.toFixed(0));
2020-03-08 23:26:24 +00:00
2020-03-12 22:53:23 +00:00
message.nowplayingDescription = client.messages.nowplayingDescription.replace("%radio.station.name%", radio.station.name);
message.nowplayingDescription = message.nowplayingDescription.replace("%radio.station.owner%", radio.station.owner);
2020-04-02 05:13:51 +00:00
message.nowplayingDescription = message.nowplayingDescription.replace("%client.funcs.msToTime(completed, \"hh:mm:ss\")%", client.funcs.msToTime(completed, "hh:mm:ss"));
2020-03-02 19:38:42 +00:00
const embed = new Discord.MessageEmbed()
2020-03-12 22:53:23 +00:00
.setTitle(client.messages.nowplayingTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, ''))
2020-03-02 19:38:42 +00:00
.setColor(client.config.embedColor)
2020-03-12 22:53:23 +00:00
.setDescription(message.nowplayingDescription)
2020-08-14 23:54:04 +00:00
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
2021-08-18 22:52:16 +00:00
return interaction.reply({ embeds: [embed] });
2020-03-02 19:38:42 +00:00
}
2020-04-02 05:13:51 +00:00
};