TypeScript Initial

This commit is contained in:
Christer Warén 2023-06-04 04:07:41 +03:00
parent 4d18468e96
commit 56f0ab5a40
39 changed files with 24 additions and 30 deletions

View File

@ -1,13 +1,13 @@
import { Client, Collection, IntentsBitField } from "discord.js";
import Datastore from "./client/classes/Datastore.js";
import Radio from "./client/classes/Radio.js";
import Stations from "./client/classes/Stations.js";
import Streamer from "./client/classes/Streamer.js";
import Statistics from "./client/classes/Statistics.js";
import Datastore from "./client/classes/Datastore";
import Radio from "./client/classes/Radio";
import Stations from "./client/classes/Stations";
import Streamer from "./client/classes/Streamer";
import Statistics from "./client/classes/Statistics;
import fs from "fs";
import { command, radio } from "./client/utils/typings.js";
import config from "./config.js";
import messages from "./client/messages.js";
import { command, radio } from "./client/utils/typings";
import config from "./config";
import messages from "./client/messages";
import path from "path";
const events = "./client/events/";
@ -41,14 +41,14 @@ class RadioClient extends Client {
this.radio = null;
this.funcs = {};
this.funcs.check = require("./client/funcs/check.js");
this.funcs.isDev = require("./client/funcs/isDev.js");
this.funcs.logger = require("./client/funcs/logger.js");
this.funcs.msToTime = require("./client/funcs/msToTime.js");
this.funcs.saveState = require("./client/funcs/saveState.js");
this.funcs.loadState = require("./client/funcs/loadState.js");
this.funcs.play = require("./client/funcs/play.js");
this.funcs.listStations = require("./client/funcs/listStations.js");
this.funcs.check = require("./client/funcs/check");
this.funcs.isDev = require("./client/funcs/isDev");
this.funcs.logger = require("./client/funcs/logger");
this.funcs.msToTime = require("./client/funcs/msToTime");
this.funcs.saveState = require("./client/funcs/saveState");
this.funcs.loadState = require("./client/funcs/loadState");
this.funcs.play = require("./client/funcs/play");
this.funcs.listStations = require("./client/funcs/listStations");
console.log('RadioX ' + this.config.version);
console.log('Internet Radio to your Discord guild');
@ -64,10 +64,6 @@ class RadioClient extends Client {
require(`${events}ready`).execute(this);
});
this.on("messageCreate", msg => {
require(`${events}messageCreate`).execute(this, msg);
});
this.on("messageDelete", msg => {
require(`${events}messageDelete`).execute(this, msg);
});

View File

@ -9,7 +9,7 @@ module.exports = class {
constructor() {
this.map = new Map();
this.mode = null;
this.logger = require("../funcs/logger.js");
this.logger = require("../funcs/logger");
}
init(client){

View File

@ -8,7 +8,7 @@ module.exports = {
async execute(client) {
const commands = [];
const commandFiles = fs.readdirSync(path.join("./src/client/commands")).filter(f => f.endsWith(".js"));
const commandFiles = fs.readdirSync(path.join("./src/client/commands")).filter(f => f.endsWith(".ts"));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);

View File

@ -1,5 +1,5 @@
import { ActionRowBuilder, EmbedBuilder, StringSelectMenuBuilder } from "discord.js";
import Streamer from "../classes/Streamer.js";
import Streamer from "../classes/Streamer";
const _importDynamic = new Function('modulePath', 'return import(modulePath)');
const fetch = (...args) => _importDynamic('node-fetch').then(({default: fetch}) => fetch(...args));

View File

@ -1,8 +1,8 @@
import Datastore from "../classes/Datastore.js";
import Radio from "../classes/Radio.js";
import Stations from "../classes/Stations.js";
import Streamer from "../classes/Streamer.js";
import Statistics from "../classes/Statistics.js";
import Datastore from "../classes/Datastore";
import Radio from "../classes/Radio";
import Stations from "../classes/Stations";
import Streamer from "../classes/Streamer";
import Statistics from "../classes/Statistics";
module.exports = {
name: 'ready',

View File

@ -35,7 +35,5 @@ module.exports = {
statusField4: ":hourglass: Latency",
statusField5: ":globe_with_meridians: Hosted by",
errorStationURL: "Station can't be URL",
messageCommandsDeprecatedTitle: "%client.user.username%",
messageCommandsDeprecatedDescription: "We recommend you to reauthorize our bot by clicking the invite link down below, because Discord is planning to remove message content from verified bots [Read More](https://support-dev.discord.com/hc/en-us/articles/4404772028055)" + "\n\n" + "**Invite Bot**" + "\n" + "https://wgi.fi/radiox_invite" + "\n\n" + "This bot now supports slash commands, you should start using them instead. Type / into the message box and select the bot you wish to use. Remember to be careful as there are a few bugs here and there on Discord." + "\n\n" + "We will remove this deprecation message in March of 2022 when RadioX 1.0.0 is released.",
maintenance: "Shhhh... We are now sleeping and dreaming about new features to implement. Will be back soon."
};