Reputation: 23
We are developing a react-native app where the client wants a 'Join Discord' button. We also want to track if the user has joined our server or not.
So we want: A Join button which will prompt users to log into/register with discord and join our server. The button will be greyed out if the user has already joined the discord server.
We can create personalized invite links for each user, store links related to each user in db and track the 'uses' of each link to check if the user has joined or not. This is an indirect method, but might work. We also thought of creating an input field on the react-native app for discord usernames and just checking if that particular user is part of the server already or not. Both of these implementations seem to be a hassle (for end user or for us) Is there any better alternative? Like login using discord and join server?
Upvotes: 2
Views: 1841
Reputation: 479
First of all, you need to make the user login to discord and to your service via discord oauth2. Save user's ID because you need it soon. Then use a bot, add it to your server and check whether that user is in the server or not, and grey the button if he's present. If not, let the bot generate invite link with only one usage, or better yet, make user login with join servers scope, and add user to your server with his auth token.
Upvotes: 2