From a34b8b7918a7659f9830bf1f611d5b914336e4e1 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Tue, 11 Dec 2018 10:39:28 -0600 Subject: [PATCH 1/2] Added message for denied apps --- api/bot.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/bot.py b/api/bot.py index da2e99f..1944bf2 100644 --- a/api/bot.py +++ b/api/bot.py @@ -105,7 +105,13 @@ class Discord(discord.Client): return else: - msg = "{0}, an application for {1} could not be found, please check your username and make sure you have applied.".format(message.author.mention, search) + count = Player.objects.filter(username__iexact=search, application__accepted=False).count() + + if count == 0: + msg = "{0}, an application for {1} could not be found, please check your username and make sure you have applied.".format(message.author.mention, search) + else: + msg = "{0}, your application has been denied. Best of luck finding a new server!".format(message.author.mention) + yield from self.discord_message(message.channel, msg) return From 1b0c1ab8df0a6ca14caea70c8a9917ad131c42dd Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Tue, 11 Dec 2018 10:53:41 -0600 Subject: [PATCH 2/2] Added case for apps still in review. --- api/bot.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/api/bot.py b/api/bot.py index 1944bf2..019e9f4 100644 --- a/api/bot.py +++ b/api/bot.py @@ -105,12 +105,16 @@ class Discord(discord.Client): return else: - count = Player.objects.filter(username__iexact=search, application__accepted=False).count() + app = Application.objects.filter(username__iexact=search).first() - if count == 0: + if app is None: msg = "{0}, an application for {1} could not be found, please check your username and make sure you have applied.".format(message.author.mention, search) - else: + elif app.accepted is None: + msg = "{0}, your application is still in review, please try again when you have been accepted on the server.".format(message.author.mention) + elif not app.accepted: msg = "{0}, your application has been denied. Best of luck finding a new server!".format(message.author.mention) + else: + msg = "{0}, an error has occurred. Please try again in a few minutes.".format(message.author.mention) yield from self.discord_message(message.channel, msg) return