mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-02 22:16:13 +00:00
Add class for interactions
This commit is contained in:
1 parent
d0f1e940a5
commit
b96a73df6f
37 files changed
+1038
-1012
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import 'dotenv/config';
|
||||
|
||||
import config from 'config';
|
||||
import { REST, RouteLike, Routes, SlashCommandBuilder } from 'discord.js';
|
||||
import { REST, RESTPostAPIChatInputApplicationCommandsJSONBody, RouteLike, Routes } from 'discord.js';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
@@ -23,8 +23,8 @@ const logger: Logger = loggerModule.child({
|
||||
|
||||
//TODO: Fix deploying not working with require()
|
||||
|
||||
const slashCommands: SlashCommandBuilder[] = [];
|
||||
const systemCommands: SlashCommandBuilder[] = [];
|
||||
const slashCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] = [];
|
||||
const systemCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] = [];
|
||||
const commandFolders: string[] = fs.readdirSync(path.resolve('./dist/interactions/commands'));
|
||||
|
||||
if (!process.env.DISCORD_BOT_TOKEN) {
|
||||
@@ -52,8 +52,7 @@ const rest: REST = new REST({ version: '10' }).setToken(process.env.DISCORD_BOT_
|
||||
|
||||
for (const file of commandFiles) {
|
||||
// TODO: create commandModule type
|
||||
const commandModule = await import(`../interactions/commands/${folder}/${file}`);
|
||||
const command = commandModule.default;
|
||||
const { default: command } = await import(`../interactions/commands/${folder}/${file}`);
|
||||
command.isSystemCommand
|
||||
? systemCommands.push(command.data.toJSON())
|
||||
: slashCommands.push(command.data.toJSON());
|
||||
|
||||
Reference in new issue
Block a user