mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-22 20:53:17 +00:00
Typescript Continue
This commit is contained in:
parent
3fc7337d0f
commit
fb36a8f890
@ -14,7 +14,7 @@ export default class {
|
||||
fs.mkdirSync(dir);
|
||||
}
|
||||
//console.log("");
|
||||
const dataFiles = fs.readdirSync(path.join(path.dirname(__dirname), '../../datastore')).filter(f => f.endsWith('.json'));
|
||||
const dataFiles = fs.readdirSync(path.join(path.dirname(__dirname), '../../datastore')).filter((f: string) => f.endsWith('.json'));
|
||||
for (const file of dataFiles) {
|
||||
try {
|
||||
const json = require(`../../../datastore/${file}`);
|
||||
|
@ -47,7 +47,7 @@ export default class Radio extends Map {
|
||||
|
||||
if(!station) return;
|
||||
|
||||
const construct = {
|
||||
const construct: any = {
|
||||
textChannel: client.channels.cache.get(state.channels.text),
|
||||
voiceChannel: client.channels.cache.get(state.channels.voice),
|
||||
connection: null,
|
||||
|
@ -1,5 +1,6 @@
|
||||
const _importDynamic = new Function('modulePath', 'return import(modulePath)');
|
||||
const fetch = (...args: any) => _importDynamic('node-fetch').then(({default: fetch}) => fetch(...args));
|
||||
// @ts-ignore
|
||||
const fetch = (...args) => _importDynamic('node-fetch').then(({default: fetch}) => fetch(...args));
|
||||
|
||||
export default class Stations extends Array {
|
||||
logger: any;
|
||||
|
@ -13,7 +13,7 @@ export default {
|
||||
}
|
||||
let commands = '';
|
||||
for (let i = 0; i < categories.length; i++) {
|
||||
commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter(x => x.category === categories[i] && !x.omitFromHelp).map((x: { name: any; }) => `\`${x.name}\``).join(', ')}\n`;
|
||||
commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter((x: { category: any; omitFromHelp: any; }) => x.category === categories[i] && !x.omitFromHelp).map((x: { name: any; }) => `\`${x.name}\``).join(', ')}\n`;
|
||||
}
|
||||
|
||||
message.helpTitle = client.messages.helpTitle.replace("%client.user.username%", client.user.username);
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { ActionRowBuilder, EmbedBuilder, StringSelectMenuBuilder } from "discord.js";
|
||||
import Streamer from "../classes/Streamer";
|
||||
const _importDynamic = new Function('modulePath', 'return import(modulePath)');
|
||||
const fetch = (...args: any) => _importDynamic('node-fetch').then(({default: fetch}) => fetch(...args));
|
||||
// @ts-ignore
|
||||
const fetch = (...args) => _importDynamic('node-fetch').then(({default: fetch}) => fetch(...args));
|
||||
|
||||
export default {
|
||||
name: 'maintenance',
|
||||
|
@ -34,7 +34,7 @@ export default {
|
||||
if(!query){
|
||||
return client.funcs.listStations(client, interaction);
|
||||
}
|
||||
let url = query ? query.replace(/<(.+)>/g, "$1") : "";
|
||||
|
||||
const radio = client.radio.get(interaction.guild.id);
|
||||
const voiceChannel = interaction.member.voice.channel;
|
||||
if (!voiceChannel) return interaction.reply({
|
||||
@ -65,13 +65,9 @@ export default {
|
||||
});
|
||||
}
|
||||
let station;
|
||||
const number = parseInt(query - 1);
|
||||
if (url.startsWith("http")) {
|
||||
return interaction.reply({
|
||||
content: client.messageEmojis["error"] + client.messages.errorStationURL,
|
||||
ephemeral: true
|
||||
});
|
||||
} else if (!isNaN(number)) {
|
||||
|
||||
if (!isNaN(query)) {
|
||||
const number = parseInt((query - 1) as unknown as string);
|
||||
if (number > client.stations.length - 1) {
|
||||
return interaction.reply({
|
||||
content: client.messageEmojis["error"] + client.messages.wrongStationNumber,
|
||||
@ -114,13 +110,14 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
let date = new Date();
|
||||
const construct = {
|
||||
textChannel: interaction.channel,
|
||||
voiceChannel: voiceChannel,
|
||||
connection: null,
|
||||
message: null,
|
||||
station: station,
|
||||
startTime: number
|
||||
startTime: date.getTime()
|
||||
};
|
||||
client.radio.set(interaction.guild.id, construct);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user