This commit is contained in:
Christer Warén 2023-06-04 07:15:30 +03:00
parent fb36a8f890
commit 2d0b326721
3 changed files with 9 additions and 5 deletions

View File

@ -1,6 +1,5 @@
const _importDynamic = new Function('modulePath', 'return import(modulePath)'); const _importDynamic = new Function('modulePath', 'return import(modulePath)');
// @ts-ignore const fetch = (...args: any) => _importDynamic('node-fetch').then(({default: fetch}) => fetch(...args));
const fetch = (...args) => _importDynamic('node-fetch').then(({default: fetch}) => fetch(...args));
export default class Stations extends Array { export default class Stations extends Array {
logger: any; logger: any;

View File

@ -1,3 +1,4 @@
import { Snowflake } from "discord.js";
const { SlashCommandBuilder } = require('@discordjs/builders'); const { SlashCommandBuilder } = require('@discordjs/builders');
const { REST } = require('@discordjs/rest'); const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9'); const { Routes } = require('discord-api-types/v9');
@ -7,7 +8,7 @@ const path = require ('path');
export default { export default {
async execute(client: any) { async execute(client: any) {
const commands : any[] = []; const commands : any = [];
const commandFiles = fs.readdirSync(path.join("./src/client/commands")).filter((f: string) => f.endsWith(".ts")); const commandFiles = fs.readdirSync(path.join("./src/client/commands")).filter((f: string) => f.endsWith(".ts"));
for (const file of commandFiles) { for (const file of commandFiles) {
@ -30,6 +31,8 @@ export default {
commands.push(command.data); commands.push(command.data);
} }
console.log(commands);
/*
const rest = new REST({ version: '9' }).setToken(client.config.token); const rest = new REST({ version: '9' }).setToken(client.config.token);
(async () => { (async () => {
@ -62,7 +65,7 @@ export default {
); );
let guilds = await client.guilds.fetch(); let guilds = await client.guilds.fetch();
guilds.forEach(async (guild: { id: any; }) => { guilds.forEach(async (guild: { id: Snowflake; }) => {
try { try {
await rest.put( await rest.put(
Routes.applicationGuildCommands(client.user.id, guild.id), Routes.applicationGuildCommands(client.user.id, guild.id),
@ -79,5 +82,7 @@ export default {
console.error(error); console.error(error);
} }
})(); })();
*/
} }
} }

View File

@ -1,3 +1,3 @@
const { default: RadioClient } = require("./Client"); import RadioClient from "./Client";
const client = new RadioClient(); const client = new RadioClient();