From 78247a07e31b6c15a903779797c0fded6b61f296 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Thu, 27 Jan 2022 01:13:42 +0200 Subject: [PATCH] random stuff --- options.json | 27 ++++++++++++++++++- src/structure/client/Logger.js | 3 +++ .../components/observers/CommandHandler.js | 20 +++++++------- src/structure/interfaces/Setting.js | 1 + 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/options.json b/options.json index f55d506..03de09a 100644 --- a/options.json +++ b/options.json @@ -1,7 +1,10 @@ { "discord": { "prefix": "]", - "developers": ["132620781791346688", "132777808362471424"], + "developers": [ + "132620781791346688", + "132777808362471424" + ], "clientOptions": { "intents": [ "GUILDS", @@ -35,5 +38,27 @@ "mariadb": { "tables": [] } + }, + "api": { + "http": { + "port": 5000 + }, + "domain": "galactic.corgi.wtf", + "authCallback": "/api/auth/login", + "dashboardUrl": "/dashboard", + "discord": { + "scope": [ + "identify", + "guilds" + ], + "token": "" + }, + "logger": { + "webhook": { + "disabled": false + } + }, + "shardCount": 1, + "debug": true } } \ No newline at end of file diff --git a/src/structure/client/Logger.js b/src/structure/client/Logger.js index f503bb9..aae0473 100644 --- a/src/structure/client/Logger.js +++ b/src/structure/client/Logger.js @@ -1,4 +1,6 @@ +/* eslint-disable max-len */ const chalk = require('chalk'); +const { inspect } = require('util'); const Constants = { ComponentTypes: { @@ -56,6 +58,7 @@ class Logger { } async transport(message = 'N/A', opts = {}) { + if (typeof message !== 'string') message = inspect(message); return this.client.intercom.send('logger', { message, ...opts }); } diff --git a/src/structure/components/observers/CommandHandler.js b/src/structure/components/observers/CommandHandler.js index 4f61128..690d03e 100644 --- a/src/structure/components/observers/CommandHandler.js +++ b/src/structure/components/observers/CommandHandler.js @@ -46,19 +46,20 @@ class CommandHandler extends Observer { const command = this._matchCommand(interaction.commandName); - let guildWrapper = null; - if(interaction.guild) guildWrapper = new GuildWrapper(this.client, interaction.guild); - const wrapper = new InteractionWrapper(this.client, command, interaction, guildWrapper); + // let guildWrapper = null; + // if(interaction.guild) guildWrapper = new GuildWrapper(this.client, interaction.guild); + // const wrapper = new InteractionWrapper(this.client, interaction, guildWrapper); + interaction.command = command; - if (!command) return wrapper.reply({ - content: wrapper.format('O_COMMANDHANDLER_COMMANDNOTSYNCED'), + if (!command) return interaction.reply({ + content: interaction.format('O_COMMANDHANDLER_COMMANDNOTSYNCED'), emoji: 'failure', ephemeral: true }); - const response = await this._parseInteraction(wrapper); + const response = await this._parseInteraction(interaction); if(response.error) { - return wrapper.reply({ - content: wrapper.format(`O_COMMANDHANDLER_TYPE${response.option.type}`, { + return interaction.reply({ + content: interaction.format(`O_COMMANDHANDLER_TYPE${response.option.type}`, { option: response.option.name, min: response.option.minimum, max: response.option.maximum }), emoji: 'failure', @@ -66,7 +67,8 @@ class CommandHandler extends Observer { }); } - await this._executeCommand(wrapper, response.options); + this.client.logger.info(`${interaction.user.tag} (${interaction.user.id}) is executing ${command.name}`); + await this._executeCommand(interaction, response.options); } diff --git a/src/structure/interfaces/Setting.js b/src/structure/interfaces/Setting.js index e7f01f5..a1f104e 100644 --- a/src/structure/interfaces/Setting.js +++ b/src/structure/interfaces/Setting.js @@ -64,6 +64,7 @@ class Setting extends Component { this.emoji = options.emoji || {}; this.default = { [this.name]: options.default || {} }; + this.definitions = options.definitions || {}; // Used for the API for field definitions this.commandOptions = options.commandOptions || [];