#Slash command

1 messages · Page 1 of 1 (latest)

native crane
#
/* Inicio / Slash Command */

client.slashcommands = new Discord.Collection();
const slashcommandsFiles = fs.readdirSync("./slashcmd").filter(file => file.endsWith("js"))

for(const file of slashcommandsFiles){
  const slash = require(`./slashcmd/${file}`)
  console.log(`Slash commands - ${file} cargando.`)
  client.slashcommands.set(slash.data.name, slash)
}

client.on("interationCreate", async interaction => {
  if(!interaction.isCommand()) return;

  const slashcmds = client.slashcommands.get(interaction.commandName)

  if(!slashcmds) return;
  
  try{
    await slashcmds.run(client, interaction)
  } catch(e) {
    console.error(e)
  }
})
#
const fs = require("fs")
const Discord = require("discord.js")
const { REST } = require("@discordjs/rest")
const { Routes } = require("discord-api-types/v9")
const { clientId, guild } = require("./confing.json")
const commands = []
const slashcommandsFiles = fs.readdirSync("./slashcmd").filter(file => file.endsWith("js"))

for(const file of slashcommandsFiles){
    const slash = require(`./slashcmd/${file}`)
    commands.push(slash.data.toJSON())
}

const rest = new REST({ version: "9" }).setToken("TOKEN")
createSlash()
async function createSlash(){
    try{
        await rest.put(
            Routes.applicationCommands(clientId, guild), {
                body: commands
            }
        )
        console.log("Slash Command Agregados.")
    } catch(e) {
        console.error(e)
    }
}
gloomy pelican
#

and what's this suppose to show? ur problem?

native crane
gloomy pelican
#

and what does that translate to?

native crane
#

everything works fine registering the slash command executes perfectly but when I ask for the data it never arrives I get the error****

gloomy pelican
#

if it's interaction failed/application did not respond, then ur bot didn't reply to the interaction

native crane
#

and what can I do about it if I don't get any errors in the console