GitSparTV / discordia-slash

Discordia application commands extension
MIT License
38 stars 13 forks source link

Invalid interaction application command #4

Closed z3n01d closed 3 years ago

z3n01d commented 3 years ago

So, when I tried to reply to interaction, this showed up : invalidInter

This is my code :

client:on("slashCommandsReady", function()
for _,i in pairs(fs.readdirSync("./commands")) do
  local fileName = string.sub(i, 1, #i - 4)
      local commandModule = require("./commands/" .. i)
          print("Loading " .. fileName)
          local commandSlash = client:slashCommand({
            name = fileName,
            description = commandModule.desc,
            options = commandModule.options,
            callback = function(ia, params, cmd)
            ia:reply("yes")
              --commandModule.execute(client, ia, params)
            end
          })
          print("Loaded " .. fileName)
          local succes, error = pcall(function()
              commandSlash:publish()
          end)
          if not succes then
          print("Failed to publish " .. fileName)
          print(error)
          else
          print("Published " .. fileName)
          end
end
end)
GitSparTV commented 3 years ago

I don't know what your code is doing here. do print(client:slashCommand ... ), second argument tells the error

z3n01d commented 3 years ago

I don't know what your code is doing here. do print(client:slashCommand ... ), second argument tells the error

It just simply replies "yes" to interaction.

GitSparTV commented 3 years ago

That is not related to the issue. Tell me what issue discordia istelling you

z3n01d commented 3 years ago

That is not related to the issue. Tell me what issue discordia istelling you

That print(client:slashCommand ... ) just shows Id and then crashes bot

GitSparTV commented 3 years ago

Can't help until you tell me the issue discordia is telling you.

local commandSlash, err = client:slashCommand({
            name = fileName,
            description = commandModule.desc,
            options = commandModule.options,
            callback = function(ia, params, cmd)
            ia:reply("yes")
              --commandModule.execute(client, ia, params)
            end
          })
          print(commandSlash, err)

          print(commandSlash:publish())