Updated nowplaying command

This commit is contained in:
Christer Warén 2021-09-05 03:33:15 +03:00
parent 2d41c7a76b
commit 38a8571ddc

View File

@ -6,40 +6,31 @@ module.exports = {
permission: 'none', permission: 'none',
category: 'radio', category: 'radio',
async execute(interaction, client) { async execute(interaction, client) {
let message = {}; if (client.funcs.check(client, interaction, command)) {
const radio = client.radio.get(interaction.guild.id); let message = {};
if (!radio) return interaction.reply({ const radio = client.radio.get(interaction.guild.id);
content: 'There is nothing playing.',
ephemeral: true let date = new Date();
}); radio.currentTime = date.getTime();
if(!client.stations) { radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime);
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild); const completed = (radio.playTime);
return interaction.reply({
content: client.messageEmojis["error"] + message.errorToGetPlaylist, message.nowplayingDescription = client.messages.nowplayingDescription.replace("%radio.station.name%", radio.station.name);
message.nowplayingDescription = message.nowplayingDescription.replace("%radio.station.owner%", radio.station.owner);
message.nowplayingDescription = message.nowplayingDescription.replace("%client.funcs.msToTime(completed)%", client.funcs.msToTime(completed));
const embed = new Discord.MessageEmbed()
.setTitle(client.messages.nowplayingTitle)
.setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, '')))
.setColor(client.config.embedColor)
.setDescription(message.nowplayingDescription)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
interaction.reply({
embeds: [embed],
ephemeral: true ephemeral: true
}); });
} }
let date = new Date();
radio.currentTime = date.getTime();
radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime);
const completed = (radio.playTime);
message.nowplayingDescription = client.messages.nowplayingDescription.replace("%radio.station.name%", radio.station.name);
message.nowplayingDescription = message.nowplayingDescription.replace("%radio.station.owner%", radio.station.owner);
message.nowplayingDescription = message.nowplayingDescription.replace("%client.funcs.msToTime(completed)%", client.funcs.msToTime(completed));
const embed = new Discord.MessageEmbed()
.setTitle(client.messages.nowplayingTitle)
.setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, '')))
.setColor(client.config.embedColor)
.setDescription(message.nowplayingDescription)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
interaction.reply({
embeds: [embed],
ephemeral: true
});
} }
}; };