contextMenuCommandDenied question

any way of getting the user who ran the context menu when the contextMenuCommandDenied listener is triggered?
Solution:
That is not the valid parameters for the listener. The types are error: Error, payload: ContextMenuCommandDeniedPayload So to get the interaction you then do payload.interaction and the guild therefore is payload.interaction.guild When programming it is always important to adhere to the parameter order and parameter types when writing and using functions. You should always consult documentation, and if working with a library like discordjs or framework like sapphire you’d also do well to refer to the source code, which gets linked for every symbol in the documentation....
Jump to solution
10 Replies
Favna
Favna•11mo ago
Every precondition gets 2 parameters, the error (type UserError) and the payload, which is a variable type but in this case ContextMenuCommandDeniedPayload. As you can see it has the interaction which means you can do interaction.user
-Carlos👑
-Carlos👑•11mo ago
sorry didn't understand
Favna
Favna•11mo ago
understand what exactly. I really cannot explain it in another way. You have a listener, its run method has 2 parameters, and those are of the aforementioned types.
-Carlos👑
-Carlos👑•11mo ago
ah ok, last question, do you know how to access the guild from that interaction? I tried stuff like i.interaction.commandGuildId or i.interaction.guildId but both return TypeError: Cannot read properties of undefined (reading 'interaction')
Lioness100
Lioness100•11mo ago
If i is the interaction then it's i.guild
-Carlos👑
-Carlos👑•11mo ago
already tried with that, it returned TypeError: Cannot read properties of undefined (reading 'guild')
Lioness100
Lioness100•11mo ago
What is i Please send your full code
-Carlos👑
-Carlos👑•11mo ago
Pastebin
contextMenuCommandDenied - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Solution
Favna
Favna•11mo ago
That is not the valid parameters for the listener. The types are error: Error, payload: ContextMenuCommandDeniedPayload So to get the interaction you then do payload.interaction and the guild therefore is payload.interaction.guild When programming it is always important to adhere to the parameter order and parameter types when writing and using functions. You should always consult documentation, and if working with a library like discordjs or framework like sapphire you’d also do well to refer to the source code, which gets linked for every symbol in the documentation.
Favna
Favna•11mo ago
@🠷Carlos👑
Want results from more Discord servers?
Add your server