Alcinzal
DIAdiscord.js - Imagine an app
•Created by Alcinzal on 7/16/2024 in #djs-questions
Send a dm to user after bot/app has been added/authorized? (user install)
I would like the process of adding my bot to go something like this:
1. Lets say I send the bot authorization link to one of my friends, to showcase it (https://discord.com/oauth2/authorize?client_id=xxxxxx)
2. They click on the link and authorize it, and upon getting back to Discord they will receive a DM like:
3. And then they can execute those commands as they wish.
How could I achieve this? Does there exist a call that happens when a user authorizes the bot? My initial thought was that this does not exist, but maybe I could use oauth redirects, however I ran into problems there too.
This link redirects correctly, with a code that looks like this "Mz9AVQsPphK3uqdTZcxUL2kJaEDH46", I am not quite sure what to do with it, but either way, when response_type is "code", the app actually doesn't get authorized.
However if the response type is "token", redirection works, and the app does actually get authorized, but from my understanding it is limited to 7 days. In my case this might be alright though.
So now after redirecting, I can get the access_token, and in theory, if I also add the
identify
scope, I should be able to get user information with the Discord API. However this returns message 401. Having the identify
scope alone works fine, however together with applications.commands
. Doesn't work.50 replies