From 3ec70dcd54d326731d9886688c4da9a7590e85cf Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Thu, 1 Sep 2022 15:33:14 -0700 Subject: [PATCH] add global command to guilds/debug global commands --- commands/help.js | 19 ++++++++----------- commands/inventory.js | 2 +- config/config.js | 2 +- events/interactionCreate.js | 2 +- util/RegisterSlashCommands.js | 2 +- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/commands/help.js b/commands/help.js index f8d3d44..0fbccbc 100644 --- a/commands/help.js +++ b/commands/help.js @@ -62,11 +62,12 @@ module.exports = { ); let Embed = new EmbedBuilder() + .setTitle('Commands') .setColor(client.config.Colors.Default) .setDescription(`${Commands.join("\n")} QuarksBot Version: v${client.config.Version}`); - if (!args[0].options[0]) return interaction.send(Embed); + if (!args[0].options[0]) return interaction.send({ embeds: [Embed] }); else { let cmd = client.commands.get(args[0].options[0].value) || @@ -100,19 +101,15 @@ module.exports = { } } embed.setDescription(description); - } else { - embed.addField( - "Usage", - `\`/${cmd.name}\`${cmd.usage ? " " + cmd.usage : ""}`, - true - ) - } + } else embed.addFields({ name: "Usage", value: `\`/${cmd.name}\`${cmd.usage ? " " + cmd.usage : ""}`, inline: true }) - return interaction.send(embed); + return interaction.send({ embeds: [embed] }); } } else if (args[0].name == 'settings') { + const userID = client.exists(interaction.user) ? interaction.user.id : interaction.member.user.id; + let settingsMenu = new SelectMenuBuilder() - .setCustomId(`settingSelect-${interaction.member.user.id}`) + .setCustomId(`settingSelect-${userID}`) .setPlaceholder('Select Setting you require help with') settings.settings.map((setting) => { @@ -125,7 +122,7 @@ module.exports = { const SelectSettings = new ActionRowBuilder().addComponents(settingsMenu); - interaction.send({ components: [SelectSettings], flags: (1 << 6) }); + interaction.send({ components: [SelectSettings], ...(!client.exists(interaction.user) && {flags: (1 << 6)}) }); // Only show ephemeral in guild } else if (args[0].name == 'support') { const supportEmbed = new EmbedBuilder() diff --git a/commands/inventory.js b/commands/inventory.js index ec7e222..133f960 100644 --- a/commands/inventory.js +++ b/commands/inventory.js @@ -1,7 +1,7 @@ const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, SelectMenuBuilder } = require('discord.js'); const { Inventory, addInventory } = require('../structures/inventory'); -const getActions = ['pick up', 'grab', 'get', 'aquire', 'obtain', 'gain', 'take possesssion of']; +const getActions = ['pick up', 'grab', 'get', 'aquire', 'obtain', 'gain', 'take possesssion of', 'retrieve']; module.exports = { name: "inventory", diff --git a/config/config.js b/config/config.js index d224500..486bc02 100644 --- a/config/config.js +++ b/config/config.js @@ -1,6 +1,6 @@ module.exports = { Dev: "PROD.", - Version: "12.3.2", + Version: "12.4.1", Admins: ["362791661274660874", "329371697570381824"], // Admins of the bot DefaultPrefix: "?", ServerID: "955668596745461830", diff --git a/events/interactionCreate.js b/events/interactionCreate.js index b105272..83955a6 100644 --- a/events/interactionCreate.js +++ b/events/interactionCreate.js @@ -1,7 +1,7 @@ const { EmbedBuilder } = require("discord.js"); const settings = require('../config/settingsHelp'); -const dropActions = ['ditch', 'drop', 'forget', 'throw out', 'leave', 'set down', 'let go of']; +const dropActions = ['ditch', 'drop', 'forget', 'throw out', 'leave', 'set down', 'let go of', 'discard']; module.exports = async (client, interaction) => { if (interaction.isCommand()) return; diff --git a/util/RegisterSlashCommands.js b/util/RegisterSlashCommands.js index 41ae715..a3f2845 100644 --- a/util/RegisterSlashCommands.js +++ b/util/RegisterSlashCommands.js @@ -19,7 +19,7 @@ module.exports = { for (const file of commandFiles) { const command = require(`../commands/${file}`); - if (!command.global) commands.push(command); + commands.push(command); // Include global commands in guild } const rest = new REST({ version: '10' }).setToken(client.config.Token);