forked from snxraven/RavenAI
fixing more crap I broke lol
This commit is contained in:
parent
806163e104
commit
2d52cdad8c
@ -7,6 +7,7 @@ var unirest = require('unirest');
|
||||
module.exports = {
|
||||
name: "advanced",
|
||||
description: "Formatted submit",
|
||||
private: false,
|
||||
|
||||
run: async (client, interaction) => {
|
||||
// await interaction.deferReply();
|
||||
|
@ -1,10 +1,27 @@
|
||||
const client = require("../raven_ai");
|
||||
const fs = require('fs')
|
||||
const jsonfile = require('jsonfile')
|
||||
|
||||
const { glob } = require("glob");
|
||||
const { promisify } = require("util");
|
||||
const globPromise = promisify(glob);
|
||||
|
||||
client.on("interactionCreate", async (interaction) => {
|
||||
// Slash Commands
|
||||
const slashCommands = await globPromise(`${process.cwd()}/commands/*/*.js`);
|
||||
const arrayOfSlashCommands = [];
|
||||
slashCommands.map((value) => {
|
||||
const file = require(value);
|
||||
const splitted = value.split("/");
|
||||
const directory = splitted[splitted.length - 2];
|
||||
|
||||
if (!file?.name) return;
|
||||
|
||||
const properties = { directory, ...file };
|
||||
client.slashCommands.set(file.name, properties);
|
||||
|
||||
if (["MESSAGE", "USER"].includes(file.type)) delete file.description;
|
||||
arrayOfSlashCommands.push(file);
|
||||
});
|
||||
// Slash Command Handling
|
||||
if (interaction.isChatInputCommand()) {
|
||||
|
||||
@ -12,22 +29,9 @@ client.on("interactionCreate", async (interaction) => {
|
||||
if (interaction.commandName === 'advanced'){
|
||||
console.log("Modal detected, skipping...")
|
||||
} else {
|
||||
// Process and Parse Data
|
||||
let dataToProcess = JSON.stringify(commandData[0])
|
||||
let parsedData = JSON.parse(dataToProcess)
|
||||
|
||||
// If the command is private, set ephemeral true else, set false
|
||||
if (parsedData.private == true) {
|
||||
await interaction.deferReply({
|
||||
ephemeral: true
|
||||
}).catch(() => {});
|
||||
|
||||
} else {
|
||||
await interaction.deferReply({
|
||||
ephemeral: false
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
// If not, defer and wait for edits - Max 15 Minutes!
|
||||
// Send defer depending on what the user has their privacy set to
|
||||
await interaction.deferReply({ ephemeral: false }).catch(() => { });
|
||||
}
|
||||
|
||||
// Get command info
|
||||
|
Loading…
Reference in New Issue
Block a user