My commands aren't updating
I've set the defaultGuild on my bot config, when I restart my bot, the commands aren't updated on my guild so I cannot test them.
54 Replies
God knows what's going on it doesn't even register the commands at all anymore
I have to kick my bot and reinvite it every time?
Why does it swallow exceptions and print this? How can I see my exceptions?
Unfortunately, an error occurred during command processing. Please let a staff member know.
They'll be in the logs
They're not swallowed
Make sure you have an SLF4J logging provider set up, eg logback, log4j, slf4j-simple
The commands should be updated if they're defined correctly, so my guess is that you're not checking the logs for errors? Or maybe you are? Please confirm
Ah I see that's why it was warning about no logger
yep, you need a logger
if defaultGuild is set does it not register the command on other servers at all ?
I have a couple of servers I want to test but only the one set as defaultGuild responds, the rest dont respond
defaultGuild is, well, a default
for commands without a guild set, it'll use that, if set
if the command has a guild set, it shouldn't use that
This is what happens if I don't set the guild as default
I see something about an unknown slash command in the logs
hmm, well, you'll get that log message when a slash command is registered on the Discord API side, but it couldn't be matched to a command you have set up on your bot
are you sure the extension containing the command has been added?
Yes
Because it works on the defaultGuild, I have no logic around adding it conditionally
hmm
can you show me your command definition?
which part?
omg pls remove that slow mode
right, I see..
and this is without a guild set? so then how did you set the guild at command level?
I'm not sure what you mean
well, your problem is that commands aren't recognised when you try to register them to a guild that isn't the set default guild, right?
I thought it registers them globally?
yes, this looks like a global command to me - though it'll be a guild command if you have a default guild set
Not both?
No, they're different scopes
So if I set a defaultGuild then my bot wont work in any other guilds?
that's the point of that setting, yeah
it's mostly useful for testing above all else
I want to test in multiple guilds, how can I achieve this?
though you can override it at the command level
well, my question is, what difference are you expecting by using another guild?
I want other people to be able to use my bot while its in development, I don't want to invite everyone to my guild
Solution
then don't use
defaultGuild
then I have to wait an hour for every change ?
you shouldn't really be testing with your production bot in the first place
the point of defaultGuild is that, when introduced, global commands took up to an hour to update in the client, so you probably wanted to temporarily make them guild commands while testing
Ah I see this wasn't developed with cowboy developers in mind lol
in practise they tend to not actually take that long anymore, though
it's worth noting that that delay mostly exists for modifying existing commands, occasionally it matters for creating them
but if a command already exists and you just changed the action, it shouldn't change much about the existing command
I'm not sure what you mean by cowboy developers lmao, it's generally better not to test in production tho
cowboy developers = shit developers that don't follow good practice
Like me
it's not necessarily a bad developer trait lmao
it's just not how most people write software
I have two modes of development, cowboy mode, when I'm in a new area, and I'm not sure what's going on, then full production mode, when I'm confident enough to write good code
I normally write an awful prototype/POC, then rewrite it all when I know it can work
This is working great so far
it's probably worth noting
that like, making all commands guild commands on all guilds is.. very intensive on the API
you'd get slammed hard by rate limits
It's probably in like 5 servers max
and registering 1 command
for now
discord has strict rate limits on command reg though
Okay I'll bear that in mind
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
How could I add a global exception handler?
To essentially change the
Unfortunately, an error occurred during command processing. Please let a staff member know.
messageWhat would you like to change it to?
There's a couple ways to do things here, depending on what you want
Is there a global error handler?
In the JVM sense? No
There is a translation string you can override and a formatting function
There's also a Sentry integration
So, again, what are you trying to do here?
Nothing I was just wondering if there was a global exception handler
Like the one in spring
I dunno what spring does, but no, haha
They let you do something like this
Something like that would be neat
I don't really see any practical use for that given the current formatting features
But also, sending your exception message or traceback is poor UX, which is why most big bots don't do it
If you want to be notified of production errors and keep track of them, use the Sentry integration
Ok
Sentry provides a free plan for small projects, OSS project sponsorships, and you can also self host it
It's an excellent service
Which event is fired when the bot is added to a guild
So I can send a welcome message
Guild create I think? But it's also fired on startup
You'll need to store some state so you know whether you've sent the welcome message before
Though on some servers, you won't have a channel to send one to, so bear that in mind
Was your original question solved?
We shouldn't reuse the same thread for a different question
Yes
can you mark the solution then?
thank