From 0b2d9b50ccdef3da9b6180f030fc0e26dcb83965 Mon Sep 17 00:00:00 2001 From: Taken Date: Fri, 20 Oct 2023 00:00:43 +0200 Subject: [PATCH] Added support for db vars to staff apps Signed-off-by: Taken --- events/buttons/staffapply.js | 7 ++++--- scripts/dev-deploy.js | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/events/buttons/staffapply.js b/events/buttons/staffapply.js index fe89d8a..6d6c4bb 100644 --- a/events/buttons/staffapply.js +++ b/events/buttons/staffapply.js @@ -5,10 +5,9 @@ const { staffApplicationsChannel } = require('../../config/options.json'); const { sq1, sq2, sq3, sq4, sq5, sq6 } = require('../../config/questions.json'); const { rsq1, rsq2, rsq3, rsq4, rsq5, rsq6 } = require('../../config/questions.json'); const { guildRole, guildStaff } = require('../../config/roles.json') -const env = require('dotenv').config(); -const status = process.env.STAFFAPPSTATUS; const mongoose = require('mongoose'); const staffapp = require('../../schemas/staffAppSchema.js'); +const settings = require("../../schemas/settingsSchema.js"); const fetch = require('axios'); module.exports = { @@ -23,12 +22,14 @@ module.exports = { const embedColor = Number(color.replace("#", "0x")); const userRoles = interaction.member.roles.cache; const mojangAPI = "https://api.mojang.com/users/profiles/minecraft/" + const setting = await settings.findOne({ name: "staffAppStatus" }) + const status = setting.value; if (interaction.customId === "staffapply") { await interaction.deferReply({ ephemeral: true }); - if (status === "false") { + if (status === "0") { await interaction.editReply({ content: "Staff applications are currently closed.", ephemeral: true }); return } diff --git a/scripts/dev-deploy.js b/scripts/dev-deploy.js index 4aa81b7..0d25294 100644 --- a/scripts/dev-deploy.js +++ b/scripts/dev-deploy.js @@ -9,7 +9,8 @@ const commands = []; // const commandFiles = fs.readdirSync('./commands-testing').filter(file => file.endsWith('.js')); const commandFiles = [ - "../commands/config.js" + "../commands/config.js", + "../commands/setup.js" ] // Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment