TypeScript types

This commit is contained in:
Christer Warén
2023-06-04 05:48:42 +03:00
parent 9303c4fcc9
commit 3fc7337d0f
36 changed files with 131 additions and 119 deletions

View File

@ -1,5 +1,5 @@
export default function check(client, interaction, command) {
let message = {};
export default function check(client: any, interaction: any, command: any) {
let message: any = {};
const radio = client.radio.get(interaction.guild.id);
if(client.config.maintenanceMode){
interaction.reply({

View File

@ -1,4 +1,4 @@
export default function isDev(devList, authorID){
export default function isDev(devList : any, authorID : any){
let response = false;
Object.keys(devList).forEach(function(oneDev) {
let devID = devList[oneDev];

View File

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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
export default function msToTime(duration) {
export default function msToTime(duration : number) {
let seconds = Math.floor((duration / 1000) % 60),
minutes = Math.floor((duration / (1000 * 60)) % 60),
hours = Math.floor((duration / (1000 * 60 * 60)) % 24),

View File

@ -1,7 +1,7 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
export default async function play(client, interaction, guild, station) {
let message = {};
export default async function play(client: any, interaction: any, guild: any, station: any) {
let message: any = {};
const radio = client.radio.get(guild.id);
const audioPlayer = client.streamer.listen(station);
radio.connection.subscribe(audioPlayer);

View File

@ -1,4 +1,4 @@
export default function saveState(client, guild, radio){
export default function saveState(client: any, guild: any, radio: any){
client.datastore.checkEntry(guild.id);
let date = new Date();