Is there a good way to register all commands at once?
I tried literally everything to get
getKord().createGlobalApplicationCommands {}
to function
But unless i wanna create a massive file with every command in there seperately, it wont work.
ATM all the registering code is inside its own class files. but as soon as i try doing input("a","b") {}
(for example) inside a loop it wont work, even if said loop only runs once.
Now my previous method of just spamming dc with register requests for each command on startup... works... but i would rather not have to do that, since sooner or later itll ratelimit me.
To be clear, yes doing doing:
works, but I would rather not have to do that
(im using normal kord, not kord extensions)6 Replies
ATM all the registering code is inside its own class files. but as soon as i try doing input("a","b") {} (for example) inside a loop it wont work, even if said loop only runs once.Could you share the not-working code?
sure
In the init functions of my Commands class I have this code:
To be clear however, this doesnt work either
the register function in commands literally just does this, unless overridden:
If i do this however:
it obviously works fine, I also tried setting this to a variable if that somehow would matter, but no luck
I should mention that this:
works fine (aka getting a command and doing .register without going through a loop, I dislike this solution tho because then i already have all commands in a list so i can reference them later.
So based on this my assumption is that its a scoping issue
Why do you have a break here? And how is
commands
defined?because i thought maybe the issue was that it registered the same cmd every loop
this is commands
it just makes an object of every command for future use
oh bruh, ig i found my issue
give me 1 sec, if thats actually the issue ill close the post, but im pretty dissapointed in myself not spotting that
Ok, im less of an idiot than i thought, still dumb tho.
Appearently my commands list was name-shadowed because the createglobalapplicationcommandsbuilder or whatever long name its called internally also has a commands list, so it was using that instead of mine.
thx for the help btw