#How do i get interaction's integration type (the ApplicationIntegrationType class)?

54 messages · Page 1 of 1 (latest)

crystal pecan
#

I tried to look in the docs and poke around with typescript, found nothing

keen pineBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • 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!
crystal pecan
#

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

tender wraithBOT
crystal pecan
#

not that

#

its the context, i need the integration type

fervent forge
#

Theres nothing more than that though

crystal pecan
#

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

fervent forge
#

the context tells you where the command was used

crystal pecan
#

if the command was used in the guild but its ephemeral and only user installable, i still dont want to use guild locale

fervent forge
#

Not too sure if it happens in a guikd whether it'll be user or guild, but that guild wont then be cached

crystal pecan
#

???

#

how is caching relevant here

#

hm, aparently there is interaction.command.integrationTypes, but for me the interaction.command is null, strange

fervent forge
#

If its a user app command in a guild, said guild wont be cached, thats one way to determine

crystal pecan
#

what if its installed in the guild too

#

and has some guild commands

fervent forge
#

Then it will be cached, if you have the Guilds intent

crystal pecan
#

well, here is the problem with this approach then

fervent forge
crystal pecan
#

isnt it strange that interaction.command is null when the interaction is CommandInteraction

#

The invoked application command, if it was fetched before

fervent forge
#

Yeah it relies on cache

crystal pecan
#

well crap

fervent forge
#

so you'd have to have your commands cached for that to work

crystal pecan
#

how do i cache them?

fervent forge
#

And even then that wont really be usefuk because that will include the integration types you set, not the one thats used

tender wraithBOT
fervent forge
#

.fetch() that

#

no because thats your command you have deployed

crystal pecan
#

if the user command only has user integration type then it cant be used on the server

#

and thus i use user locale

fervent forge
#

but if both integrationtypes are set, they will both be returned

crystal pecan
#

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

fervent forge
#

well what if that command was used outside of a guild

crystal pecan
#

not a perfect solution but

crystal pecan
#

hmm

#

so i guess there is no perfect solution

fervent forge
#

I'm not even sure if you can access the guild locale as a user app

crystal pecan
#

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)

tender wraithBOT
fervent forge
#

Forgot thos existed

#

might be useful too

crystal pecan
#

oh