mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-14 04:30:18 +00:00
Adding more typings
This commit is contained in:
parent
16ef8e70e6
commit
24a6e80f26
@ -9,8 +9,8 @@ export interface datastore {
|
|||||||
id: string,
|
id: string,
|
||||||
name?: string
|
name?: string
|
||||||
},
|
},
|
||||||
statistics: statistics | {},
|
statistics: statistics,
|
||||||
state: state | {},
|
state: state | null,
|
||||||
updated?: string
|
updated?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ export default class Datastore {
|
|||||||
id: id,
|
id: id,
|
||||||
},
|
},
|
||||||
statistics: {},
|
statistics: {},
|
||||||
state: {}
|
state: null
|
||||||
};
|
};
|
||||||
this.map.set(id, newData);
|
this.map.set(id, newData);
|
||||||
this.saveEntry(id, newData);
|
this.saveEntry(id, newData);
|
||||||
|
@ -16,10 +16,10 @@ export interface radio {
|
|||||||
playTime?: number,
|
playTime?: number,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface state extends Object {
|
export interface state {
|
||||||
channels: {
|
channels: {
|
||||||
"text": string,
|
"text": string | undefined,
|
||||||
"voice": string
|
"voice": string | undefined
|
||||||
},
|
},
|
||||||
date: string,
|
date: string,
|
||||||
station: {
|
station: {
|
||||||
@ -62,7 +62,7 @@ export default class Radio extends Map {
|
|||||||
let state = client.funcs.loadState(client, guild);
|
let state = client.funcs.loadState(client, guild);
|
||||||
|
|
||||||
if(!state) return;
|
if(!state) return;
|
||||||
if(!state.hasOwnProperty('station') || !state.hasOwnProperty('channels')) return;
|
if(state.channels?.text === undefined || state.channels?.voice === undefined) return;
|
||||||
|
|
||||||
let voiceChannel = client.channels.cache.get(state.channels.voice);
|
let voiceChannel = client.channels.cache.get(state.channels.voice);
|
||||||
if(!voiceChannel || !(voiceChannel instanceof VoiceChannel)) return;
|
if(!voiceChannel || !(voiceChannel instanceof VoiceChannel)) return;
|
||||||
@ -97,7 +97,7 @@ export default class Radio extends Map {
|
|||||||
let date = new Date();
|
let date = new Date();
|
||||||
construct.startTime = date.getTime();
|
construct.startTime = date.getTime();
|
||||||
client.datastore?.checkEntry(guild.id);
|
client.datastore?.checkEntry(guild.id);
|
||||||
//@ts-ignore
|
|
||||||
client.funcs.play(client, null, guild, station);
|
client.funcs.play(client, null, guild, station);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { ButtonInteraction, ChatInputCommandInteraction, ColorResolvable, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
|
import { ButtonInteraction, ChatInputCommandInteraction, ColorResolvable, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
|
||||||
import RadioClient from "../../Client";
|
import RadioClient from "../../Client";
|
||||||
|
import { station } from "../classes/Stations";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'list',
|
name: 'list',
|
||||||
@ -21,7 +22,7 @@ export default {
|
|||||||
if(radio && !client.config.maintenanceMode){
|
if(radio && !client.config.maintenanceMode){
|
||||||
client.funcs.listStations(client, interaction);
|
client.funcs.listStations(client, interaction);
|
||||||
} else {
|
} else {
|
||||||
let stations = `${client.stations.map((s: { name: any; }) => `**#** ${s.name}`).join('\n')}`
|
let stations = `${client.stations.map((s: station) => `**#** ${s.name}`).join('\n')}`
|
||||||
const hashs = stations.split('**#**').length;
|
const hashs = stations.split('**#**').length;
|
||||||
for (let i = 0; i < hashs; i++) {
|
for (let i = 0; i < hashs; i++) {
|
||||||
stations = stations.replace('**#**', `**${i + 1}.**`);
|
stations = stations.replace('**#**', `**${i + 1}.**`);
|
||||||
|
@ -7,7 +7,7 @@ export default function loadState(client: RadioClient, guild: OAuth2Guild) {
|
|||||||
if(!data) return;
|
if(!data) return;
|
||||||
let state = data.state;
|
let state = data.state;
|
||||||
if(!state) return;
|
if(!state) return;
|
||||||
data.state = {};
|
data.state = null;
|
||||||
client.datastore.updateEntry(guild, data);
|
client.datastore.updateEntry(guild, data);
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user