Replace any types to more strict types

This commit is contained in:
Christer Warén
2023-06-06 04:58:01 +03:00
parent bc238d919d
commit 3686cd1b0e
7 changed files with 29 additions and 27 deletions

View File

@ -1,20 +1,19 @@
import { ActionRowBuilder, StringSelectMenuBuilder } from "discord.js";
import { ActionRowBuilder, SelectMenuComponentOptionData, StringSelectMenuBuilder } from "discord.js";
import RadioClient from "../../Client";
import { station } from "../classes/Stations";
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; }) => {
let options : SelectMenuComponentOptionData[] = new Array();
client.stations.forEach((station: station) => {
if(station.name == "GrooveFM") return;
station = {
options.push({
label: station.name,
description: station.owner,
value: station.name
};
options.push(station);
});
});
const menu = new ActionRowBuilder()
@ -25,9 +24,6 @@ export default function listStations(client: RadioClient, interaction: any){
.addOptions(options)
);
stations = null;
options = null;
return interaction.reply({
content: '**Select station:**',
components: [menu],

View File

@ -1,8 +1,11 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ColorResolvable, EmbedBuilder } from "discord.js";
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ChatInputCommandInteraction, ColorResolvable, EmbedBuilder, Guild, StringSelectMenuInteraction } from "discord.js";
import RadioClient from "../../Client";
import { station } from "../classes/Stations";
export default async function play(client: RadioClient, interaction: any, guild: any, station: any) {
export default async function play(client: RadioClient, interaction: ChatInputCommandInteraction | StringSelectMenuInteraction | null, guild: Guild | null, station: station) {
if(!guild) return;
let message: any = {};
const radio = client.radio?.get(guild.id);
const audioPlayer = client.streamer?.listen(station);
radio.connection.subscribe(audioPlayer);

View File

@ -1,6 +1,7 @@
import { Guild } from "discord.js";
import RadioClient from "../../Client";
export default function saveState(client: RadioClient, guild: any, radio: any){
export default function saveState(client: RadioClient, guild: Guild, radio: any){
if(!client.datastore) return;
client.datastore.checkEntry(guild.id);