#How do i get interaction's integration type (the ApplicationIntegrationType class)?
54 messages · Page 1 of 1 (latest)
- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - Not a discord.js issue? Check out #1081585952654360687.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
discord.js 14.16.2
node 23.2.0
so, im getting a CommandInteraction interaction and i want to get the integration types of it
CommandInteraction#context [email protected]
Context where the interaction was triggered from
Theres nothing more than that though
hmm
well im making localization and i dont want to translate only user-installed commands to the guild language
so thats why i want integration type
the context tells you where the command was used
yes, but thats not what i need
if the command was used in the guild but its ephemeral and only user installable, i still dont want to use guild locale
Not too sure if it happens in a guikd whether it'll be user or guild, but that guild wont then be cached
???
how is caching relevant here
hm, aparently there is interaction.command.integrationTypes, but for me the interaction.command is null, strange
If its a user app command in a guild, said guild wont be cached, thats one way to determine
Then it will be cached, if you have the Guilds intent
well, here is the problem with this approach then
as for this, not too sure but that might depend on the command being cached
isnt it strange that interaction.command is null when the interaction is CommandInteraction
The invoked application command, if it was fetched before
Yeah it relies on cache
well crap
so you'd have to have your commands cached for that to work
how do i cache them?
And even then that wont really be usefuk because that will include the integration types you set, not the one thats used
ClientApplication#commands [email protected]
The application command manager for this application
i mean it will, no?
if the user command only has user integration type then it cant be used on the server
and thus i use user locale
but if both integrationtypes are set, they will both be returned
yeah, thats when i use guild locale, no?
cuz if the command can be installed in both user and guild then its probably not ephemeral
well what if that command was used outside of a guild
not a perfect solution but
if interaction.guild?
hmm
so i guess there is no perfect solution
I'm not even sure if you can access the guild locale as a user app
i dont need to?
if the command is user only i skip guild locale
ugh, yeah, its not gonna work
i guess i can just have an optional param, like localeTarget, and use it if there is a command that is both user and guild, for example /remind that accepts a target (remind user/guild)
CommandInteraction#authorizingIntegrationOwners [email protected]
Mapping of installation contexts that the interaction was authorized for the related user or guild ids
oh