Ben855 - How are most of y'all using IDhints in pr...
How are most of y'all using IDhints in production? Are you just manually hard coding them every time you decided to add a command or is there a better option?
Photon•554d ago
That’s what I do too, hardcode it 😦
Ben•554d ago
oof
Photon•554d ago
There’s no way to inject it somehow too which is hard sometime
Ben•554d ago
wdym buy that? If I have a map or something that was setup before the bot is constructed, wouldn't I be able to set the IDhint to
map.get('some other id that I use in places')
?Photon•554d ago
Yeah you gotta override a lot of things then, when the registry calls start
Ben•554d ago
Why would that be the case though? If the hint resolves before the registry even exists why would that matter.
Photon•554d ago
If you resolve the hint before the registry exists then in that case you will have to hardcode the Id again
Because you won’t like to make the API call twice
One from sapphires side and one from yours side to get the command ids
Ben•554d ago
I'm not following you. Why would the API get called before the client is instantiated?
Photon•554d ago
When the Ids aren’t hardcoded and you want to resolve it dynamically
Else it will be justi what it’s now
Ben•554d ago
Right but I'm not resolving it from the API. I'm planning to resolve them from my database before the client is instantiated.
Photon•554d ago
Then you can just make a custom command class and inject the id from there I think
Ben•554d ago
ooh thats a good idea. If its injected in the command constructor that will be before any registry calls are made right?
Photon•554d ago
Yeah, I do that to register the command using decorator. Pretty quick setup, you can see the implementation here https://github.com/r-priyam/goblin/blob/main/src/lib/extensions/GoblinCommand.ts
Ben•554d ago
I've already got a custom command class set up for some global permissions and global subcommand stuff. I can probably add the id hint resolution there as long as the constructor runs to completion before any registry api calls are made.
Photon•554d ago
I use it to register the command for myself so that I don’t have to call an extra method lol
Ben•554d ago
Yeah that probably would work. I'll give it a shot I guess.
Photon•554d ago
Cool
Sawako•554d ago
I use environment
Ben•554d ago
One environment var for every command?
Thats a lot of environment variables.
Sawako•554d ago
well, not in my case because I use group of subcommands
And well, in the case of individual commands, well, that would be enough if you have enough commands, but this way you can update the id hints without having to change your code
Ben•554d ago
Yeah thats gonna be a hard pass.
Sawako•554d ago
Ben•553d ago
I marked as a solution mostly to make Answer Overflow happy and because thats what I'm currently attempting to do. I'm still very much open to any ideas though.
Okay heres my final solution for anyone wondering. About a minute and a half after my bot starts, I save all command IDs (not discord snowflakes, just identifiers I have for each command that wont change even if the name changes) and their interaction IDs into my database. This way any new commands are always saved after they are created. Before bot startup, I populate a map with that information from the DB and make it accessible on container. I then can use that map when registering commands to get any idHints for that specific command. So far this has worked pretty well in testing.
Sawako•553d ago
Or use env vars
It seems to me a very complex system for that
Ben•553d ago
almost 40 commands remember
Sawako•553d ago
Well in my opinion I don't see the problem of having several environment
Ben•553d ago
and more to be added on later. This way I dont have to start my bot in prod, get the id once its registered, add it to my env vars, and then restart my bot to have it actually take affect. Its a whole lot of manual work in what I currently have as a completely automated build and deployment process.
Having a lot is only a minor issue to me tbh. Its more that I want something automatic since everything else about my deployments doesnt require any manual intervention other than a single commit.
Sawako•553d ago
Remember that the ids do not change, that is, it is something that you will only do once
And you don't need to restart your bot to see the new ids, you can use apps (https://slash-commands-gui.androz2091.fr/) to manage your slash commands and see their ids
Then put it in the environment variables and that's it.
Ben•553d ago
* once every time I slashify a command or add a new one. So thats already almost 40 times with more to come in the future. It might not be a ton of effort but its more than my new no effort setup.
Now I just never have to worry about it. They should always just work™️ on startup.
Welcome to the Sapphire Discord server! The next-gen object-oriented Discord.js bot framework can be found here.
2.2KMembers
View on DiscordWant results from more Discord servers?
More PostsNytelife26 - can i use `ApplyOptions` with an app...can i use `@ApplyOptions` with an application command, and if so do I still need to use `registerChaRhys - Is it possible to put preconditions on butt...Is it possible to put preconditions on button interactions? Looking through the docs / code it didn'Fiery - Hi, just got a new laptop and I'm having s...Hi, just got a new laptop and I'm having some troubles with the @sapphire/type library. I can't get bomi - Seems this is a known problem on discords e...Seems this is a known problem on discords endbomi - Discord's sending big ints? ``(node12164) ...Discord's sending big ints?
```
--------------------------RATE LIMIT--------------------------
(nodkaname-png - Paginated message brokenPaginated message broken${j122j} - Is there any way I change the typescrip...Is there any way I change the typescript types for container.client to be my own client class?
It exChaddiedaddie - I tried to follow the Getting sta...I tried to follow the "Getting started with Sapphire" part of the guide on the sapphire website and kaname-png - Why does this interaction option retu...Why does this interaction option return null?dragonizedpizza - can I give a list of possible el...can I give a list of possible elements in shapeshift's s.string.arrayeslint oomhey besties, your eslint config somehow OOMs eslint <3 what the fuck
ctx: Running it with `next lintSomehow registry not registering@vladdy Bug Report:
Code: https://v.gd/Ftwkcz
Problem: Help command not being registered
Expected ouyesAre you trying to add a role to the member or..?Notion document feedback, issues, questions and answersHello @everyone! Now, before you bring out the pitchforks and the <:Ping:504396173935771668>, <:cockPoll Discussion & Answers1️⃣ → *Interaction Handler*
2️⃣ → *In the command with the same name / id*
3️⃣ → *Other (please explApplication Command Registry Interface v1@here Your feedback is required again! We're inching closer and closer to having application commandHow should you, the end user, define commands?⚠️ **How should you define what application commands are for what command classes, and how should thPreconditions with missing handlers! What do?**Preconditions**: What should happen with preconditions (global or not) that need to run on a messaContext Menus vs Application Commands - separate or not?**Question time** ❓
Context menus.. they exist. They're like used once a blue century. How should Interaction Handlers after usageWant to give interaction handlers a shot **now**?
Well, you can! Just run the command below and giv