Generate an invite link to add a user to a role.


137 opmerkingen

  • JKybett

    I need this so much!
    There is a server I have where I could double the users I could be inviting to it but can't include a large demographic because there are certain areas that would have to be specific to one half of the user base or the other.
    In this specific server it is incredibly difficult (and would be very time consuming) to find out and/or verify which of these two groups users belong to but very easy to restrict which invite links these people have access to.
    I have a different server where I invite people with single-use invites and this would simplify giving the right people the right roles.
    I can also see this being useful for servers that are linked to patron systems or memberships, servers that are used in a professional setting, and any other servers using roles to identify a portion of the user base that is different for reasons external to the server.

  • Insasse

    Is there any progress on this?
    This would make life much easier for discord admins!

  • Unit_3397

    yessssssssssss please devs, +1 @Phantom



  • Eriolo

    this can be really helpful for like the current situation and teachers, discord already set a template for classrooms, but with this option i cand send to one class a link and they only have permission to the channels i want, i send other link to other class and will have permission for other channels,is perfect.

  • optivex

    please add this devs! if I create an invite on a private text channel I should have the option to get people straight in here with a link such as

  • mistr88

    If discord will be something as messenger, then yes, but the power of discord is in bots. And here, I am not saying, that this is terrible idea because you can do this by bots, but bot creators are lazy (I see it on me) and will use this and will not use the standard **universal** approach. And then, when someone will join via different invite, he will not get the starter role.

    Edit: And not putting this to API will not help, because this feature will still be useable by user bots.

  • mistr88

    And also, it's extremely easy to create own fully customized bot (about 10 mins just for this task)

  • Sebastian Nielsen

    @mistr88 No. The problem is that the bot cannot easily know which invite link a user "comes from". Yes, there is ugly solutions as like looking on invite link counts and such, but such solutions can be dangerous, especially when using them to assign moderator/admin roles.

    The second problem is if a user is already member, but gained another invite link, that would grant them a "second role". One example could be a gaming community for multiple games, where a role @Minecraft would gain them access to Minecraft-related channels, and @CSGO would gain them access to CS:GO related channels. In their minecraft server, they then have a minecraft related invite link, and in CS:GO server a CS:GO-related invite link. If a user is member of both servers, it could be a good thing if the user, after already joined @Minecraft role, could just visit the link for the @CS:GO role, and then instead of showing "Already connected" it will show a button "Give me the role" and clicking this, will then turn it into a "Already connected" button and give the role.

  • Slimeyy Here is a bot that does that, but it really should be integrated with discord

  • addisonschultz

    +1 for this feature, would be super helpful managing invited users

  • MagentaRV

    This follows in line with and for how I would use the data if it was in the API for the bot to see which invite a member is joining with on join.

  • ModerateWinGuy

    This really should just be a default feature. If only they would add this.

  • Delight

    its literally that easy:

    step 1: install node.js from

    step 2: search "node.js command prompt"

    step 3: enter "npm i discord.js" in the command prompt

    step 4: go to log in with your discord account, click on "new application", enter a name, then click "create" and click "copy" below your client id

    step 5: on the left side click on "bot", click on "add bot" then on "yes, do it"

    step 6: go to insert your client id in the field called "client id:" and click on the link

    step 7: select the server you want to have the bot on and solve the captcha

    step 8: go back to the bot section of the developer portal and click on "copy" below "your token" Make sure you dont share your token with anyone, it is like the username and password to your bot and can get your account banned.

    step 9: create a folder on your desktop called something like "Bot". create a new text file and paste code located at the bottom of this comment.

    step 10: replace "DEFAULT ROLE NAME HERE" with the default role name and replace "YOUR TOKEN HERE" with the token you just copied. save the document as "index.js"

    step 11: create another text document, insert "node index.js" in the first line and "pause" in the second line. save it as "start.bat"

    step 12: execute start.bat and your bot is running. congratulations!

    index.js code:


    const Discord = require("discord.js");
    const client = new Discord.Client();
    client.on("guildMemberAdd", newMember => {
    const defaultRole = message.guild.roles.cache.find(role => == "DEFAULT ROLE NAME HERE");
    client.login("YOUR TOKEN HERE");
  • ImRock

    That does not give roles if they use specific links that is a general auto role thing.

  • J3st3r

    Im happy for all the advice on how to work around this lack of feature, however the point of requesting a feature (in the feedback section) is the hopes the dev team can add it in to the base application.

    From my perspective, bots are best used for niche things that the devs dont feel the need to provide or to allow customization which would otherwise be impossible to facilitate within the base application, not for things that a lot of people would like implemented for QoL reasons which would make the overall application better. You see the devs put notes in when patches are applied literally stating "due to community request", its obvious they listen when they can.

    I dont see why people would actively try to shut down conversation on a request for a feature that obviously ticks the right boxes for a certain amount of people. 

  • Wayland

    Delight That is an awesome guide on how to get a discord.js bot up and running, but that does not solve the issue of "people joining with a specific invite should be automatically added to a role" your solution just adds everyone who joins the guild to a role, and that is no bueno.

    For example what if I had a role to denote users who are from a forum which I want to invite to my guild. Currently I would have to just use any invite and they would need to ask to be added the role after some sort of manual verification on my part.

    If we could somehow access data about what invite they used to join on guildMemberAdd it would be as easy as checking "is this invite they used the one that should get the special role?" and if so assign the role and if not don't. The only info available is how many times an invite has been used.

  • MasterReY

    Its funny how many people in this thread do not realize that a auto-assignment of DIFFERENT ROLES for DIFFERENT USERS (depending on the invite link) is needed.

    Yes, bots can auto assign roles.
    Yes, everyone can write his own bot and auto-assign roles.

    However whats currently NOT possible is this:
    I have one server for my streaming community and also my friends.
    I want everyone joining from the link on my stream to get the "streaming community role" auto assigned.
    I want everyone joining from the link of my friends to get the "friends" role auto assigned.
    The link itself is not important. I just can't think of another criteria to differentiate between two kinds of users.

    Please tell me I'm wrong and there is a way to do this :)

  • JKybett

    It is possible for bots to do what you're asking, in the following way:
    Make the bot track the number of people who have joined via each invite link.
    When a new user joins, check each link and assign a role based on which link has had more people join than before.
    The problem with this, is that if your bot suffers downtime while people are joining or people are joining more often than the bot is able to check this, it becomes impossible to ascertain which user is responsible for which increase in users-joined by invite link.
    Even if the devs put in a feature where the link a person used to join is recorded or each link records which specific users joined by it, this problem could be avoided. As it is, although it is possible to implement this behaviour with bots, it is not possible to trust the bot that implements this behaviour.

  • MasterReY

    Thanks for the reply JKybett!
    So it is actually possible, but i think no current bot actually implemented that feature sadly.

    Could you specify what exactly you mean with "it is not possible to trust the bot that implements this behaviour."
    Why would you not trust a bot with this specific feature, but trust it with all the other features the bots have?

  • JKybett

    Such a bot is too prone to failure for this purpose, if the different role permissions are important to your server. It's a matter of recoverability. If a bot that blocks swearing, maintains bans or performs tasks based on commands like "!help" suffers an error or downtime, the bot can re-attempt these functions when it recovers. However, since this feature requires constant monitoring of the number of people who have joined via each particular link and comparing them to existing figures, there's a specific window of opportunity during which the bot can function as normal; between one person joining and the next. If such a bot were to miss this opportunity, then it is completely incapable of determining which link these users used, rendering it useless for these people.
    So, if it's important to distinguish people upon joining to give them a specific role depending on how they joined, you can't trust this bot to do it as it could fail for any user at any time and be unable to correct itself.

  • MasterReY

    Ah okay i see. Yeah thats true.
    I somehow read your sentence in a different way that a bot who has enough permissions to do that can somehow compromise the server etc. Makes no sense :)

    So then the point of the thread here still stands. I think we really need this feature.
    My temporary solution is:
    I have given my friends the permission to "manage roles" (another big feature that is missing is the permission to only ASSIGN role and not edit/delete them) and tell them that they should manually remove the auto-assigned role and add the "friend" role instead to people they invite.

  • JKybett

    Unrelated to the feature request, but might I suggest getting a bot that can manage roles with a command to give a role to someone that your friends can use? That way your friends aren't able to edit or manage the role but can still give it to people. Sounds like what you're looking for in your workaround.

  • MasterReY

    Yeah that will be the best way.
    Thanks for your input!

  • nathanmaingard

    How is this not a thing yet? It seems so simple and it would make a huge difference to being able to filter members based on role! I do hope they implement it asap. At the moment I'm running a workshop and I want to give attendees a unique invite link which would enable them to join a specific private channel...


  • skwiggs

    Yes please <3 

  • omeganot

    Man, this is such a needed feature, especially as servers get spun up not only for gaming communities, but other communities in both business, hobby, and professional settings.  For example, I teach a variety of courses both online and in-person (when not on pandemic lockdown), generally around a similar theme.  I could have a default role which is for the main theme, but then separate roles for each specific course type, and then further roles to create groups for individual courses so that I could automatically give attendees of the course access to channels only for their specific course instance as well as interactions with attendees from any course of that type.

  • Lehman

    I'd like to run multiple classes from the same server. To reduce confusion, I need to limit channels to certain classes. This I do with roles. However, I cannot assign a role with an invite link. I have to invite the student, then I have to go in and change their role. This is a non-starter when I am trying to run multiple classes out of the same server, and I have more than 100 students in each class. If Discord is looking to broaden their market, this is pretty important. The way it stands I have to have a different server for each class/section.

  • Erudian

    This is another of those ideas that has me scratching my head as to why it hasn't already been implemented (like "fast" profile switching and hyperlink markdown). I totally agree that this would be a tremendous QoL update, especially for server admins and such. The only thing I can think of that would prevent it would be the update to permission settings it would require.

    Can any user that is allowed to generate an invite do so with role selection? Some/most server admins would probably want to be able to control that. But, adding a sub-option for the Create Invite permission (e.g., Auto-Assign Role from Invite) would likely solve that.

    Another "possibility" for this could also be that, if the invite is for a specific (private) channel that has explicit permissions set, the invite could automatically assign any roles that at least have the Read Text Channels & See Voice Channels permission for that channel. I know that doesn't completely address the issue here and might be more trouble than it's worth, but it would at least be a start.


U moet u aanmelden om een opmerking te plaatsen.