From ab87e748f9d26ac77cbaf6de6fbdbed8355c4ec5 Mon Sep 17 00:00:00 2001 From: Parker2991 Date: Wed, 6 Nov 2024 12:21:44 -0500 Subject: [PATCH] added es6 and common js examples for commands templates in data --- src/commands/console/console.js | 1 + src/data/commonJSCommandFormat.js | 19 +++++++++++++++++++ src/data/es6JSCommandFormat.mjs | 19 +++++++++++++++++++ src/modules/command_manager.js | 4 ++-- 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 src/data/commonJSCommandFormat.js create mode 100644 src/data/es6JSCommandFormat.mjs diff --git a/src/commands/console/console.js b/src/commands/console/console.js index 98b4b4b..0eb6e30 100644 --- a/src/commands/console/console.js +++ b/src/commands/console/console.js @@ -2,6 +2,7 @@ module.exports = { data: { name: 'console', trustLevel: 4, + description: "", aliases: [ ], diff --git a/src/data/commonJSCommandFormat.js b/src/data/commonJSCommandFormat.js new file mode 100644 index 0000000..f43a070 --- /dev/null +++ b/src/data/commonJSCommandFormat.js @@ -0,0 +1,19 @@ +module.exports = { + data: { + name: '', + trustLevel: 0, // trust levels: 0, 1, 2, 3, 4 + aliases: [ + "" + ], + description: '', + usages: [ + "" + ], + }, + execute (context) { + + }, + discordExecute (context) { + + } +} diff --git a/src/data/es6JSCommandFormat.mjs b/src/data/es6JSCommandFormat.mjs new file mode 100644 index 0000000..a5f0ca7 --- /dev/null +++ b/src/data/es6JSCommandFormat.mjs @@ -0,0 +1,19 @@ +export default { + data: { + name: '', + trustLevel: 0, // trust levels: 0, 1, 2, 3, 4 + aliases: [ + + ], + description: '', + usages: [ + "" + ], + }, + execute (context) { + + }, + discordExecute (context) { + + } +} diff --git a/src/modules/command_manager.js b/src/modules/command_manager.js index c24f7d6..6df51a6 100644 --- a/src/modules/command_manager.js +++ b/src/modules/command_manager.js @@ -155,8 +155,8 @@ async function command_manager (bot, options, config, discordClient) { const filePath = path.join(commandsPath, filename); if (filename.endsWith('.mjs')) { let command = await import(filePath); - bot.commandManager.register(command); - bot.commandManager.commandlist.push(command); + bot.commandManager.register(command.default); + bot.commandManager.commandlist.push(command.default); } if (filename.endsWith('.js')) { let command = require(filePath);