register now checks if a user with a nickname matching to the player is already on the server

reminder
Joey Hines 2018-12-10 13:26:14 -06:00
parent 03f5c87334
commit fdb51af5c2
1 changed files with 11 additions and 5 deletions

View File

@ -73,12 +73,18 @@ class Discord(discord.Client):
nickname = player.username
if not player.is_banned:
role = discord.utils.get(message.server.roles, name=self.member_role)
msg = "Successfully added {0} as a {1}.".format(nickname, self.member_role)
member = discord.utils.get(message.server.members, display_name=nickname)
yield from self.change_nickname(message.author, nickname)
yield from self.add_roles(message.author, role)
yield from self.discord_message(message.channel, msg)
if member is not None and member is not message.author:
msg = "{0}, a member with that name is already exists, please contact the staff".format(message.author.mention)
yield from self.discord_message(message.channel, msg)
else:
role = discord.utils.get(message.server.roles, name=self.member_role)
msg = "Successfully added {0} as a {1}.".format(nickname, self.member_role)
yield from self.change_nickname(message.author, nickname)
yield from self.add_roles(message.author, role)
yield from self.discord_message(message.channel, msg)
else:
msg = "{0} You are currently banned, appeal on the subreddit.".format(message.author.mention)