How to check if Member Authorzied with OAuth2 Application?

Hey someone got the knowledge. I have a Embed message with a Button and the oauth2 authorzie link in it. How Can i implemend in the Code, that the Bot check if the User have it self authorized and give him a specific Role. My latest Code: https://pastebin.com/XGmBgH8n with the error Code:
const interactions = await client.application.commands.get('verify').interactions.fetch();
^

TypeError: client.application.commands.get is not a function
at Client.<anonymous> (C:\Users\mezep\Desktop\DevBot\bot.js:36:57)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.10.0
const interactions = await client.application.commands.get('verify').interactions.fetch();
^

TypeError: client.application.commands.get is not a function
at Client.<anonymous> (C:\Users\mezep\Desktop\DevBot\bot.js:36:57)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.10.0
I know the client.application.commands.get is the problem but I dont know, how to fix that rightly. Thanks for everybody help! :D
Pastebin
const { Client, Intents, Permissions, MessageEmbed, EmbedBuilder, M...
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.
3 Replies
d.js toolkit
d.js toolkit•11mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - 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!
meze
meze•11mo ago
[email protected] node v20.10.0
treble/luna
treble/luna•11mo ago
djs does not support oauth2 and you'd use fetch instead of get and handle the promise it returns
Want results from more Discord servers?
Add your server