Jda: Get invite code on member Join

Created on 14 Oct 2018  路  6Comments  路  Source: DV8FromTheWorld/JDA

General Troubleshooting

  • [x] I have checked for similar issues.
  • [x] I have updated to the latest JDA version.
  • [x] I have checked the branches or the maintainers' PRs for upcoming features/bug fixes.

Issue

Issue Type

  • [ ] Bug Report
  • [x] Feature Request

Description

Get info of the invite code when user join if they join via a invite link.

discord issue feature

Most helpful comment

Note:
I think this was not relevant in 2018 but nowadays you also have to check for missing invites in your new list as they could be expired by MaxUses.
Furthermore, if there are two or more invites missing and only one of those had MaxUses, this is the invite that has been used. (The others expired by time)

If two or more invites are missing in your new list you cannot safely assign the used invite. This most likely happens if you forget to cache new invites on GuildInviteCreateEvent.

All 6 comments

This information is not available from the Discord API...yet.

See https://github.com/discordapp/discord-api-docs/issues/448

I wrote a bot to do this with an algorithm, so it's still possible to create.

And how do you code that?

@YukioKeno

  1. Store how many times all invites have been used
  2. When a user joins, see which invite has a use incremented by 1
  3. That's probably the invite they used.

Okay thank you. I'll try that :)

Note:
I think this was not relevant in 2018 but nowadays you also have to check for missing invites in your new list as they could be expired by MaxUses.
Furthermore, if there are two or more invites missing and only one of those had MaxUses, this is the invite that has been used. (The others expired by time)

If two or more invites are missing in your new list you cannot safely assign the used invite. This most likely happens if you forget to cache new invites on GuildInviteCreateEvent.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StijnSimons picture StijnSimons  路  3Comments

hitsu420 picture hitsu420  路  6Comments

MinnDevelopment picture MinnDevelopment  路  5Comments

istamendil picture istamendil  路  3Comments

M4itreG picture M4itreG  路  5Comments