Closed thecookieswhoplays closed 1 year ago
@NamVr check this out, the guys asked for my opinion on Discord but you are more up to date on this project than me.
I don't understand the purpose, what does it do exactly?
let's say I want a button which send a msg to a user. You could make the id sendmsg-[userid] and then on the button handler create a file sendmsg-[id] you can then access id with interaction.args.id to then send the message to him.
I still don't get it, why need so much changes when you can just pass properties via the button function.
Most other good templates and framework offer this option. Let's say you want to make a button through this handler, but you must store custom data with it. This is (mostly) the only way.
It's also a non-breaking change that add an option, why not!
Can't you just de-structure the customId from button handler directly? "sample-12345" just get "12345", why need changes in core template?
It's also a non-breaking change that add an option, why not!
The code seems to be poorly written and I don't see any actual purpose of this feature here. It makes no sense to pass extra data with buttons because of customId, you know you're using THAT customId for THAT purpose. Correct me if I'm wrong.
How would the handler know which js function to execute on receiving sample-12345? You don't know in advance what the id will be.
The handler doesn't have to know about this as this a custom functionality. To be noted this template needs to be fairly basic and simple for all users by keeping just enough features for it to function properly and good. It is really possible to add hundreds of such custom features into the template but again it ruins the simplicity of the template, it is also meant to be beginner friendly. We don't want to create custom functionality that might conflict with functionality a user would try to make, many people customize button handler to their liking and this could potentially cause conflicts for the same.
By this I have an idea to add wildcard entries as customId functionality, that would be very good and will support all custom features as mentioned in this PR.
https://github.com/NamVr/DiscordBot-Template/blob/master/events/buttonInteraction.js#L27
You can modify this statement right at line 27 as mentioned to include a regex test instead of normal checking. Then in "id" section of a button handler, you can create the regex and buttonInteraction.js will test that regex and handle it appropriately.
By this I have an idea to add wildcard entries as customId functionality, that would be very good and will support all custom features as mentioned in this PR.
It's pretty much what this is...
Correct, I dropped correct hints here to get started. Thank you for leaving the PR for the idea!
What it does is that you can add args by adding them like this. commandname-[arg1]-[arg2] you can then access them from the interaction.args.arg1 like this