mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-10 03:00:18 +00:00
Remove Now Playing command
This commit is contained in:
parent
8b36ff0459
commit
d904d65eed
@ -6,7 +6,6 @@ import invite from "./commands/invite";
|
|||||||
import list from "./commands/list";
|
import list from "./commands/list";
|
||||||
import maintenance from "./commands/maintenance";
|
import maintenance from "./commands/maintenance";
|
||||||
import next from "./commands/next";
|
import next from "./commands/next";
|
||||||
import nowplaying from "./commands/nowplaying";
|
|
||||||
import play from "./commands/play";
|
import play from "./commands/play";
|
||||||
import prev from "./commands/prev";
|
import prev from "./commands/prev";
|
||||||
import statistics from "./commands/statistics";
|
import statistics from "./commands/statistics";
|
||||||
@ -22,7 +21,7 @@ export interface command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default async function commands(client: RadioClient) {
|
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){
|
for(const command of commands){
|
||||||
client.commands.set(command.name, command);
|
client.commands.set(command.name, command);
|
||||||
|
@ -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
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
@ -18,7 +18,7 @@ export default {
|
|||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messages.emojis["stop"].replace(/[^0-9]+/g, ''))
|
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messages.emojis["stop"].replace(/[^0-9]+/g, ''))
|
||||||
.setColor(client.config.embedColor)
|
.setColor(client.config.embedColor)
|
||||||
.addFields({
|
.addFields({
|
||||||
name: client.messages.nowplayingTitle,
|
name: client.messages.playTitle1,
|
||||||
value: "-"
|
value: "-"
|
||||||
})
|
})
|
||||||
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
|
Loading…
Reference in New Issue
Block a user