Giter VIP home page Giter VIP logo

discordia-slash's Issues

Command with no parameters errors

local params = makeParams(data.options, ia.guild)

data.options is optional according to the interaction data structure spec
https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure

Uncaught Error: ...uff/ACCOUNT TRACKER/deps/discordia-slash/Application.lua:26: bad argument #1 to 'ipairs' (table expected, got nil)
stack traceback:
        [C]: in function 'ipairs'
        ...uff/ACCOUNT TRACKER/deps/discordia-slash/Application.lua:26: in function 'makeParams'
        ...uff/ACCOUNT TRACKER/deps/discordia-slash/Application.lua:48: in function <...uff/ACCOUNT TRACKER/deps/discordia-slash/Application.lua:42>

Invalid interation application command

local dis = require("discordia")
local slash = require("discordia-slash")
slash.constructor()
local client = dis.Client()
client:useSlashCommands()

client:on("slashCommandsReady", function()
	client:slashCommand({
		name = "test2",
		description = "description",
		options = {
			{
				name = "arg",
				description = "argdesc",
				type = slash.enums.optionType.string,
				required = true
			}
		},
		callback = function(ia, params, cmd)

		end
	})
end)

Ran this code (Basically straight from the readme docs) and got this error
Screenshot 2022-01-17 184351

Console
Screenshot 2022-01-17 184345

I'm new to Discordia and this addon so sorry If I'm being dumb

Invalid interaction application command

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)

attempt to index local 'args' (a nil value) error when the only optional argument is not provided

whenever a slash command option is optional and not provided, it returns this error:

attempt to index local 'args' (a nil value)

this is my code:

local slashCommand = {}
local option = {}

slashCommand = tools.slashCommand("amount", "see amount of flops you/user have/has said")
option = tools.user("member", "the member")

option = option:setRequired(false)

slashCommand = slashCommand:addOption(option)

client:createGlobalApplicationCommand(slashCommand)
client:on("slashCommand", function(interaction, command, args)
    if command.name == "amount" then
        if db[ tostring( args.member.id ) ] then
            interaction:reply( args.member.name .. " has said flop " .. tostring( db[ tostring( args.member.id ) ] ) .. " times" )
        else
            interaction:reply( args.member.name .. " hasn't said flop" )
        end
    end
end)

any help?

Didn't work for me

Can a video tutorial be made about this? I'm super confused about how I should be doing this. I tried to use:
client:slashCommand()
using the example. It doesn't show up as an error anymore, but I'm not sure what's supposed to happen after. The slash command doesn't appear in Discord, and when I tried to test the example ban command, it came up with an error (yes, I changed "guildid" to the actual guild id). It just errors with "bad request," and I'm stumped on how to fix this. Slash commands for my bot aren't THAT important to me, but I'd like to have them.

Missing Not

A believe there is a missing not in discordia-slash -> util -> tools.lua line 236.

v.type in makeParams returns nil

For some users, the v.type (subCommand) returns nil.
Uncaught Error: /home/santa/deps/discordia-slash/Application.lua:33: attempt to call a nil value

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.