Typescript Continuum

This commit is contained in:
Christer Warén
2023-06-05 00:13:15 +03:00
parent 0e62861e33
commit c584e3632e
33 changed files with 152 additions and 94 deletions

View File

@ -1,6 +1,8 @@
export default function check(client: any, interaction: any, command: any) {
import RadioClient from "../../Client";
export default function check(client: RadioClient, interaction: any, command: any) {
let message: any = {};
const radio = client.radio.get(interaction.guild.id);
const radio = client.radio?.get(interaction.guild.id);
if(client.config.maintenanceMode){
interaction.reply({
content: client.messageEmojis["error"] + client.messages.maintenance,

View File

@ -1,9 +1,12 @@
import { ActionRowBuilder, StringSelectMenuBuilder } from "discord.js";
import RadioClient from "../../Client";
export default function listStations(client: any, interaction: any){
let stations: any = new Array();
export default function listStations(client: RadioClient, interaction: any){
let stations: any = new Array();
let options: any = new Array();
if(!client.stations) return;
stations = client.stations.forEach((station: { name?: any; owner?: any; label?: any; description?: any; value?: any; }) => {
if(station.name == "GrooveFM") return;
station = {

View File

@ -1,6 +1,8 @@
import { Guild } from "discord.js";
import RadioClient from "../../Client";
export default function loadState(client: any, guild: Guild){
export default function loadState(client: RadioClient, guild: Guild){
if(!client.datastore) return;
let data = client.datastore.getEntry(guild.id);
if(!data) return;
let state;

View File

@ -1,5 +1,5 @@
export default function logger(area : string, text: string){
let date = new Date();
console.log('[' + area + '] ' + date.toISOString());
console.log('[' + area + '] - ' + date.toISOString());
if(text) console.log(text + '\n');
}

View File

@ -1,9 +1,10 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ColorResolvable, EmbedBuilder } from "discord.js";
import RadioClient from "../../Client";
export default async function play(client: any, interaction: any, guild: any, station: any) {
export default async function play(client: RadioClient, interaction: any, guild: any, station: any) {
let message: any = {};
const radio = client.radio.get(guild.id);
const audioPlayer = client.streamer.listen(station);
const radio = client.radio?.get(guild.id);
const audioPlayer = client.streamer?.listen(station);
radio.connection.subscribe(audioPlayer);
client.funcs.logger('Radio', guild.id + " / " + "Play" + " / " + radio.station.name);
@ -16,7 +17,7 @@ export default async function play(client: any, interaction: any, guild: any, st
const embed = new EmbedBuilder()
.setTitle(client.user.username)
.setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, '')))
.setColor(client.config.embedColor)
.setColor(client.config.embedColor as ColorResolvable)
.addFields({
name: client.messages.nowplayingTitle,
value: message.nowplayingDescription

View File

@ -1,4 +1,7 @@
export default function saveState(client: any, guild: any, radio: any){
import RadioClient from "../../Client";
export default function saveState(client: RadioClient, guild: any, radio: any){
if(!client.datastore) return;
client.datastore.checkEntry(guild.id);
let date = new Date();