From 6a45fe217a9564b872d47a9c5da672a2e345a51b Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sun, 29 Sep 2019 07:47:45 -0500 Subject: [PATCH] Fixed issue where users could register in PMs and with `me` --- GeoffreyBot/geoffrey_api.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/GeoffreyBot/geoffrey_api.py b/GeoffreyBot/geoffrey_api.py index 7113371..5bbf51f 100644 --- a/GeoffreyBot/geoffrey_api.py +++ b/GeoffreyBot/geoffrey_api.py @@ -496,8 +496,9 @@ class GeoffreyCommands(commands.Cog): message = ["{}, you have the following locations:".format(ctx.message.author.mention)] - for location in locations: - message.append(formatted_location(location)) + if locations: + for location in locations: + message.append(formatted_location(location)) await self.bot.send_list(ctx, message) @@ -507,9 +508,14 @@ class GeoffreyCommands(commands.Cog): {}register """ errors = { - "PlayerInDBError": "you are already registered with Geoffrey you ding dong." + "PlayerInDBError": "you are already registered with Geoffrey you ding dong.", + "UsernameLookupFailed": "could not find a MC user from your username. Have a mod update your nickname." } + if ctx.message.guild is None: + await ctx.send("{}, You can not register for geoffrey in the DMs!".format(ctx.message.author.mention)) + return + await run_command(ctx, self.api_url, self.api_token, "POST", "register", errors=errors, player_name=ctx.message.author.display_name, discord_uuid=ctx.message.author.id)