Remove Now Playing command

This commit is contained in:
Christer Warén 2023-11-28 13:04:30 +02:00
parent 8b36ff0459
commit d904d65eed
3 changed files with 2 additions and 65 deletions

View File

@ -6,7 +6,6 @@ import invite from "./commands/invite";
import list from "./commands/list";
import maintenance from "./commands/maintenance";
import next from "./commands/next";
import nowplaying from "./commands/nowplaying";
import play from "./commands/play";
import prev from "./commands/prev";
import statistics from "./commands/statistics";
@ -22,7 +21,7 @@ export interface command {
}
export default async function commands(client: RadioClient) {
const commands : command[] = [ bug, help, invite, list, maintenance, next, nowplaying, play, prev, statistics, status, stop ];
const commands : command[] = [ bug, help, invite, list, maintenance, next, play, prev, statistics, status, stop ];
for(const command of commands){
client.commands.set(command.name, command);

View File

@ -1,62 +0,0 @@
import { ButtonInteraction, ChatInputCommandInteraction, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
import RadioClient from "../../Client";
import { command } from "../commands";
export default {
name: 'nowplaying',
description: 'Current Radio Station',
category: 'radio',
async execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient, command: command) {
if(client.funcs.check(client, interaction, command)) {
const radio = client.radio?.get(interaction.guild?.id);
let date = new Date();
radio.currentTime = date.getTime();
radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime);
const completed = (radio.playTime);
if(radio.station?.playlist?.type == "supla" || radio.station?.playlist?.type == "yle"){
let playlist: any = await fetch(radio.station.playlist.address)
.then((response: Response) => response.json())
.catch(error => {
});
try {
switch(radio.station?.playlist.type){
case "supla":
radio.station.track = "__" + playlist.items[0]?.artist + "__" + "\n" + playlist.items[0]?.song;
break;
case "yle":
radio.station.track = "-";
break;
default:
radio.station.track = "-";
}
} catch(TypeError) {
}
}
const embed = new EmbedBuilder()
.setTitle(client.messages.nowplayingTitle)
.setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messages.emojis["play"].replace(/[^0-9]+/g, '')))
.setColor(client.config.embedColor)
.setDescription(client.messages.replace(client.messages.nowplayingDescription, {
"%radio.station.name%": radio.station.name,
"%radio.station.owner%\n": radio.station.name != radio.station.owner ? radio.station.owner + "\n" : "",
"%client.funcs.msToTime(completed)%": client.funcs.msToTime(completed),
"\n\n%radio.station.track%": radio.station.track != undefined ? "\n\n" + radio.station.track : ""
}))
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({
text: client.messages.footerText,
iconURL: "https://cdn.discordapp.com/emojis/" + client.messages.emojis["eximiabots"].replace(/[^0-9]+/g, '')
});
interaction.reply({
embeds: [embed],
ephemeral: true
});
}
}
};

View File

@ -18,7 +18,7 @@ export default {
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messages.emojis["stop"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.addFields({
name: client.messages.nowplayingTitle,
name: client.messages.playTitle1,
value: "-"
})
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')