Application Command Registry Interface v1
@here Your feedback is required again! We're inching closer and closer to having application commands in Sapphire, but there's still places where polishing is required, and most importantly, your feedback is wanted!
As you're hopefully used to already, here's the notion doc with examples: https://vladfrangu.notion.site/Current-code-examples-for-registering-Application-Commands-in-Sapphire-6720eeb8f8be4cfa92292c44f1db9a2c
Please note that these are samples. They may change per your feedback, and at the end, I will create a repository showing it off in an actual code base for those that have uncertainties!
So hit me in the thread attached to this message - thoughts? Like it? Dislike it? Why? What would you want to see different?
Vlad Frangu's Notion on Notion
Current code examples for registering Application Commands in Sapphire
Per the vote in the thread, I've been drafting code samples with how you can register commands in Sapphire. Feedback is important, so please reply in the thread attached to this with your thoughts.
fried•934d ago
looks great
vladdy•934d ago
how in the mcfuck did you read that document so fast
fried•934d ago
um
bulgarian genetics
RealShadowNova•934d ago
fried•934d ago
registry
cool
𝖄𝖚𝖌𝖊𝖓•934d ago
looks great
fried•934d ago
its like windows
actually when i started to read it
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
fried•934d ago
looks pretty good
vladdy•934d ago
For context, to me this feels like the cleanest way to register what command classes can handle what slash commands (and also handle things like guild commands that are supposed to run the same code, etc)
This will also handle registering it with Discord for you!
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
24•934d ago
overrideBehaviorOnDuplicate
maybe?𝖄𝖚𝖌𝖊𝖓•934d ago
So
The store is a Store?
A sapphire pieces store?
fried•934d ago
i like stores
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
vladdy•934d ago
no
the RegistryStore is a store of registries, not a piece
Namings
bitomic•934d ago
the registry stuff feels kinda weird compared to the rest of sapphire's stuff
not something bad per se, tho
𝖄𝖚𝖌𝖊𝖓•934d ago
Yeh might wanna avoid that
Because if it was a store. The container property makes no sense. But since its not. The name makes no sense
Haha
Only feedback I got
vladdy•934d ago
NAMING ASIDE
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
vladdy•934d ago
I'll search a better name for the registry store
ideally as little as possible
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
𝖄𝖚𝖌𝖊𝖓•934d ago
:No:
Favna•934d ago
@vladdy can you make it so
registerApplicationCommands
is automatically called by setting a CommandOption? such as
registerChatInputCommand: boolean
which then uses the defaults of this.name
and this.description
, and default_permission
to true
(also default, no need to specify that one)
This will save on having to override and implement that method either on every command or force everyone to create their own command class that extends command to do the same.Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
𝖄𝖚𝖌𝖊𝖓•934d ago
Released when?
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
vladdy•934d ago
registerApplicationCommands is automatically called if it's present no matter what. However, I am against the defaults part, especially with some upcoming features for application commands
Favna•934d ago
no I don't meean if it's present. I don't want to have it to be present at all in my code.
𝖄𝖚𝖌𝖊𝖓•934d ago
Nick shutup
Favna•934d ago
nickk please keep the thread serious
vladdy•934d ago
when most people are happy
fried•934d ago
ok well i dont really understand this registry thing
24•934d ago
Then don't participate.
fried•934d ago
ok
Favna•934d ago
.
fried•934d ago
oh so its like an in depth command
vladdy•934d ago
Please explain whats confusing about it :D
fried•934d ago
idk long words
Favna•934d ago
I don't know what Vladdy's plans are per se but Permissions v2 will deprecate mostly anything of what we would make.
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
fried•934d ago
actionWhenCommandIsPresentButNotIdentical
thats a really long one
vladdy•934d ago
Permissions are undergoing changes at Discord's level, so, at this time, no
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
Favna•934d ago
Then get a dictionary and disect every word @friedxd. We're not a primary school here.
fried•934d ago
😦
vladdy•934d ago
well yes and not, they mean different things both for us internally and you externally
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
fried•934d ago
OHHHH this is for like application commands
that looks great
vladdy•934d ago
Highly unlikely to happen due to the fact people may want to, for instance, intl their description know it's annoying
Favna•934d ago
then they override it?
or they dont set the option?
I never said the option should default to true
vladdy•934d ago
Hmm
Favna•934d ago
Default it to false in fact if you want, that's fine by me
writing code...
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
24•934d ago
Why are we deviating from "store.get"?
vladdy•934d ago
Because you can use it without the ping command having a registry already
I can consider a
registerChatInputCommandWithDefaults
I suppose, but it's definitely not my priority rn. I'd need to think of a name, deal with the default_permissions headache, options too, just.. its really not something that I see as a need due to most commands having at least an arg
But notedFavna•934d ago
This is very clean and concise. Much more so than
vladdy•934d ago
how would you provide the registerbehavior
Is it a default to overwrite?
Favna•934d ago
ninja'd it in
vladdy•934d ago
log to console?
Favna•934d ago
uh didn't you write in the notion the default is warn rn?
vladdy•934d ago
Well yes
trying to see if I missed anyone else's message
RedS•934d ago
vladdy•934d ago
What's confusing you the most?
These methods separate how we route the interactions we get to the right file/method, hence why there's a split between chat input and context menu commands, even if they look like they do the same thing
This will mean we must make command descriptions required. Thats an annoyance for non-chat input command users, I guess I can make it required only for those that use the options but still..
bitomic•934d ago
Maybe that it isn't a piece, while everything else is a piece?
Although I understand the hot mess that would be handling the command registering from
Command
class at the same time you handle everything elsevladdy•934d ago
The registry is simply a fancy ui for a map of what goes where. Ignore the store in the name of the ApplicationCommandRegistryStore
bitomic•934d ago
something like this could be great, from my opinion
vladdy•934d ago
of that, are there any questions, suggestions, requests, issues, broken dreams?
24•934d ago
honestly I want to see how this pans out
I want to see how this integrates with existing sapphire applications, and see how it works
vladdy•934d ago
Well I wanna get it right the first time
24•934d ago
I think accepting both builders is a great thing, and I kinda think the syntax is fine... maybe bloated, but works
I don't know if I'd change the names though.
bitomic•934d ago
"CommandThingy", "StoringThingy", "UnnamedThing2" (?)
vladdy•934d ago
Yean names are elongatedbois rn its pain
How does
whenCommandIsPresentButNotIdentical
sound? @Favna @daimond113 @twenty_fourUnknown User•934d ago
Message Not Public
Sign In & Join Server To View
24•934d ago
better...
commandOverrideStrategy
?Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
24•934d ago
I see it being vague... override what??
vladdy•934d ago
override is vague
24•934d ago
commandAmbiguityStrategy
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
24•934d ago
2 characters longer than mind... smh
vladdy•934d ago
ifCommandPresentButNotIdentical
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
24•934d ago
ifCommandPresentNotIdentical
no buts here boysUnknown User•934d ago
Message Not Public
Sign In & Join Server To View
24•934d ago
whatToDoOnCommandMatch
vladdy•934d ago
whenPresentButNotIdentical
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
vladdy•934d ago
technically uk
practically idk
24•934d ago
whatToWithIdenticalCommand
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
vladdy•934d ago
behaviorWhenNotIdentical
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
24•934d ago
I think that works
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
24•934d ago
minus the obviously wrong british spelling (usa strong)
vladdy•934d ago
well I'm not bri'ish
so its the us spelling
24•934d ago
well thank god for that
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
24•934d ago
no
we don't test here
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
24•934d ago
yeah, no worries here bud
(note: not responsible for test deletion)
vladdy•934d ago
current line/total lines
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
24•934d ago
not when you have DI
just
.get
itUnknown User•934d ago
Message Not Public
Sign In & Join Server To View
𝖄𝖚𝖌𝖊𝖓•934d ago
Plenty broken dreams
vladdy•934d ago
So, people here, other than the feedback you gave me about the 3 things, is there anything else? I wanna know before I work on the implementation
𝖄𝖚𝖌𝖊𝖓•934d ago
Nah. Just naming (:
vladdy•934d ago
@here
waketh up 🙏
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
24•934d ago
no
fried•934d ago
im wacthig
vladdy•934d ago
already solved
its at the bottom of the notion
RedS•934d ago
24•934d ago
think this system works
vladdy•934d ago
the faster I get feedback, the faster the progress
fried•934d ago
its cool
do it as it is nopw
24•934d ago
LGTM.
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
vladdy•934d ago
What about them
I already explained they handle different things internally
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
vladdy•934d ago
you mean..an..array..of register calls?
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
vladdy•934d ago
is that REALLY needed
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
adrian•934d ago
For
vladdy•934d ago
I say you can DIY it with an array and calling the method
Unknown User•934d ago
Message Not Public
Sign In & Join Server To View
adrian•934d ago
That's what I thought
vladdy•934d ago
aight time to get to coding
Unknown User•932d ago
Message Not Public
Sign In & Join Server To View
adrian•932d ago
they're options so I would presume they'll be handled as such
unaware of actual intentions though
vladdy•932d ago
well right now you get a generic discord.js CommandInteraction/ContextMenuInteraction, so I assume the plugins will update to give a nicer support too
Unknown User•932d ago
Message Not Public
Sign In & Join Server To View
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 PostsHow 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 givInteraction Handlers!!Hello peeps!
I know, I know, allllll of you (myself included) are just basically begging me for appInitial Commit ThoughtsI've pushed the initial commit for interaction handlers: heavily wip, totally untested and raw (justThe statefulness or statelessness of Interactions1. Most likely, but it would be a nice addition if I was able to have non-state "callbacks" as mentiInteraction handlers in the command instead of globallyHonestly. I would much rather add interactions from my command and from there tell to continue in (fReply sess 2**1.** Yes. This also follows the design pattern that we more-or-less employ already for Sapphire. Wdont feel like creating a review on GitHub...PR is up: https://github.com/sapphiredev/utilities/pull/152
CC @kyra 🩵🩷🤍🩷🩵 @vladdy