From e6c47b704d2292b5c54d774d7afec261a3ea7897 Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Fri, 5 Aug 2022 13:19:59 -0700 Subject: [PATCH] only show inventory view to author --- commands/inventory.js | 2 +- events/messageCreate.js | 36 ------------------------------------ structures/QuarksBot.js | 10 +++++----- 3 files changed, 6 insertions(+), 42 deletions(-) delete mode 100644 events/messageCreate.js diff --git a/commands/inventory.js b/commands/inventory.js index 19b5fad..0cc39ed 100644 --- a/commands/inventory.js +++ b/commands/inventory.js @@ -211,7 +211,7 @@ module.exports = { if (args[0].name == 'view') { // Display Inventory - + let inventoryEmbed = new MessageEmbed() .setColor(client.config.EmbedColor) .setTitle('Your Inventory') diff --git a/events/messageCreate.js b/events/messageCreate.js deleted file mode 100644 index b105a36..0000000 --- a/events/messageCreate.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * - * @param {require("../structures/QuarksBot")} client - * @param {require("discord.js").message} message - * @returns {void} or nothing if you didn't know - */ - -module.exports = async (client, message) => { - if (message.guild.id === client.config.serverID) return; - if (message.author.bot || message.channel.type === "dm") return; - - let GuildDB = await client.GetGuild(message.guild.id); - - //Prefixes also have mention match - const prefixMention = new RegExp(`^<@!?${client.user.id}> `); - prefix = message.content.match(prefixMention); - - if (message.content.indexOf(prefix) !== 0) return; - - if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(message.channel.id)) { - return message.channel.send(`You are not allowed to use the bot in this channel.`); - } - - const args = message.content.slice(prefix.length).trim().split(/ +/g); - //Making the command lowerCase because our file name will be in lowerCase - const command = args.shift().toLowerCase(); - - //Searching a command - const cmd = - client.commands.get(command) || - client.commands.find((x) => x.aliases && x.aliases.includes(command)); - - //Executing the codes when we get the command or aliases - if (cmd) cmd.run(client, message, args, { GuildDB }); - else return; -}; \ No newline at end of file diff --git a/structures/QuarksBot.js b/structures/QuarksBot.js index 0707f5c..7db2013 100644 --- a/structures/QuarksBot.js +++ b/structures/QuarksBot.js @@ -48,11 +48,11 @@ class QuarksBot extends Client { type: 4, data: typeof message == "string" - ? { content: message } - : message.type && message.type === "rich" - ? { embeds: [message] } - : message, - }, + ? { content: message, ...(message.ephemeral && {flags: (1 << 6)}), } + : message.embeds[0] && message.embeds[0].type === "rich" + ? { embeds: message.embeds, ...(message.ephemeral && {flags: (1 << 6)}), } + : { message, ...(message.ephemeral && {flags: (1 << 6)}), }, + } }); }; let cmd = client.commands.get(command);