From 418645ebd81eb45e1e6422206735f48133c3c5ca Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Sat, 6 Aug 2022 13:14:57 -0700 Subject: [PATCH] debug --- .../{connectAccount.js => connect_account.js} | 2 +- ...onnectAccount.js => disconnect_account.js} | 2 +- commands/ping.js | 1 - config/config.js | 2 +- structures/LinesPoliceCadBot.js | 39 +++++++++---------- util/RegisterSlashCommands.js | 1 + 6 files changed, 23 insertions(+), 24 deletions(-) rename commands/{connectAccount.js => connect_account.js} (97%) rename commands/{disconnectAccount.js => disconnect_account.js} (97%) diff --git a/commands/connectAccount.js b/commands/connect_account.js similarity index 97% rename from commands/connectAccount.js rename to commands/connect_account.js index 39854a1..692e89f 100644 --- a/commands/connectAccount.js +++ b/commands/connect_account.js @@ -1,7 +1,7 @@ const { MessageEmbed } = require('discord.js'); module.exports = { - name: "connectAccount", + name: "connect_account", description: "Connect your Discord Account to the Lines Police CAD Database", usage: "", permissions: { diff --git a/commands/disconnectAccount.js b/commands/disconnect_account.js similarity index 97% rename from commands/disconnectAccount.js rename to commands/disconnect_account.js index 5a0ffe0..ef5f79b 100644 --- a/commands/disconnectAccount.js +++ b/commands/disconnect_account.js @@ -1,7 +1,7 @@ const { MessageEmbed } = require('discord.js'); module.exports = { - name: "logout", + name: "disconnect_account", description: "Disconnect your Discord account from the Lines Police CAD Database", usage: "", permissions: { diff --git a/commands/ping.js b/commands/ping.js index adfcbb5..792ea9d 100644 --- a/commands/ping.js +++ b/commands/ping.js @@ -8,7 +8,6 @@ module.exports = { channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"], member: [], }, - aliases: [], SlashCommand: { options: [], /** diff --git a/config/config.js b/config/config.js index a83b41b..b2489a8 100644 --- a/config/config.js +++ b/config/config.js @@ -21,4 +21,4 @@ module.exports = { name: "Grand Theft Auto V", // The message shown type: "PLAYING", // PLAYING, WATCHING, LISTENING, STREAMING }, -} +} \ No newline at end of file diff --git a/structures/LinesPoliceCadBot.js b/structures/LinesPoliceCadBot.js index b2e2298..c903c25 100644 --- a/structures/LinesPoliceCadBot.js +++ b/structures/LinesPoliceCadBot.js @@ -28,39 +28,38 @@ class LinesPoliceCadBot extends Client { this.Ready = false; this.ws.on("INTERACTION_CREATE", async (interaction) => { - client.log("Interaction") let GuildDB = await this.GetGuild(interaction.guild_id); - + if (interaction.type==3) return; - const command = interaction.data.name.toLowerCase(); const args = interaction.data.options; - + //Easy to send respnose so ;) interaction.guild = await this.guilds.fetch(interaction.guild_id); interaction.send = async (message) => { return await this.api - .interactions(interaction.id, interaction.token) - .callback.post({ - data: { - type: 4, - data: - typeof message == "string" - ? { content: message } - : message.type && message.type === "rich" - ? { embeds: [message] } - : message, - }, + .interactions(interaction.id, interaction.token) + .callback.post({ + data: { + type: 4, + data: + typeof message == "string" + ? { content: message } + : message.type && message.type === "rich" + ? { embeds: [message] } + : message, + }, }); - }; - let cmd = client.commands.get(command); + }; + let cmd = client.commands.get(command); + client.log("Interaction - "+cmd.name); if (cmd.SlashCommand && cmd.SlashCommand.run) cmd.SlashCommand.run(this, interaction, args, { GuildDB }); - }); + }); - const client = this; - } + const client = this; + } async connectMongo(mongoURI, dbo) { this.db = await MongoClient.connect(mongoURI,{useUnifiedTopology:true}); diff --git a/util/RegisterSlashCommands.js b/util/RegisterSlashCommands.js index 10ea9d4..fbf7369 100644 --- a/util/RegisterSlashCommands.js +++ b/util/RegisterSlashCommands.js @@ -29,6 +29,7 @@ module.exports = (client, guild) => { await GuildAPI.commands.post({ data: dataStuff }); } catch (e) { client.log('Error: API missing permissions'); + console.log(e) } }); });