Link Application to Player if exists

reminder
Etzelia 2019-01-16 17:40:38 +01:00
parent c45f5529c7
commit 16825f0dd2
1 changed files with 4 additions and 0 deletions

View File

@ -93,6 +93,10 @@ class Discord(discord.Client):
if not application.accepted:
application.accepted = accept
application.save()
if Player.objects.filter(username__iexact=application.username).exists():
player = Player.objects.get(username__iexact=application.username)
player.application_id = application.id
player.save()
msg = "App ID **{0}** was successfully {1}.".format(match.group(2), "accepted" if accept else "denied")
api.plugin("accept" if accept else "deny", application.username)
else: