Get invite code
Hello !
I'd like to do something pretty simple, get the invite code the user clicked to join my guild/channel.
The reason is that i'd like to make invites for a private channel that automatically adds the appropriate role to the user so s/he can actually access that channel.
I couldn't find any way to do this.
The only "solution" i see would be to monitor the clicks count of the invite link and check if it incremented when a new user comes in. I think we can all agree that it's a far from good solution for many reasons...
I guess the "discord way" of doing this is to create a whole dedicated discord guild but i'd like to keep all the users to one place.
Maybe i missed something but after 3h of research logging every single events server side that seems unlikely.
Have a good day!
-
Thank you for your answer @pxpcandy!
I think you misunderstood my request and its context (we are in the API/developer section).
I know i can get the invites from the Discord UI but i'm talking about the API here. It's also possible to get the invite list from the API but that's still not what i'm asking for :)
What i want is that when a user joins my discord from an invite link, to know WHICH link s/he used to join it.
This way i can automate some actions depending on the link used to join the discord.
I hope it's clearer for you. If you want to undo your downvote that would be nice ;) (if that's you of course, nevermind otherwise)
2 -
This is a very good suggestion, and it seems like with the “Join Method”, they can do it. Hopefully, they'll do it soon.
2 -
oh , idk how to help then. sorry about that lol
0 -
Greetings durss.
I'm not sure if what I'm about to tell you may work, but if you check the DiscordJS documentation, theres a class called inviteCreate, that creates an invite. The parameter of this class is Invite, and if you enter to this parameter, you will be able to observe the differents properties of it. One of this properties is TargetUser, that I'm not sure of this but maybe you could play a bit with it and get the user is joining the guild.
This is the link.
Hope I've helped you.
Have a nice day, Kashix.0 -
Hello Kashix!
Thank you for your answer :)
I can't find the answer for sure without trying it myself but the TargetUser is a user object so i believe it's made to send an invite to one specific user.
In any case, my problem is not to know when a user joins the guild, this i already know, but what link the user clicked to join it. The TargetUser being a user object it won't be much helpful in any case :/
I just saw a very old UI update suggestion that approaches my request :
Thank you again for trying to help !
Much appreciated :D
0 -
This is very much a needed feature to help server admins. Perhaps we want to reward members who invite X users. Or perhaps our server is being spam raided and we need to kill the invite they're all using. The current methods are kludgy and make it difficult to track single-use invites.
0 -
Already possible, click server settings then invites to see a list of all invites
-1
サインインしてコメントを残してください。
コメント
7件のコメント