register now checks if a user with a nickname matching to the player is already on the server
parent
03f5c87334
commit
fdb51af5c2
16
api/bot.py
16
api/bot.py
|
@ -73,12 +73,18 @@ class Discord(discord.Client):
|
||||||
nickname = player.username
|
nickname = player.username
|
||||||
|
|
||||||
if not player.is_banned:
|
if not player.is_banned:
|
||||||
role = discord.utils.get(message.server.roles, name=self.member_role)
|
member = discord.utils.get(message.server.members, display_name=nickname)
|
||||||
msg = "Successfully added {0} as a {1}.".format(nickname, self.member_role)
|
|
||||||
|
|
||||||
yield from self.change_nickname(message.author, nickname)
|
if member is not None and member is not message.author:
|
||||||
yield from self.add_roles(message.author, role)
|
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)
|
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:
|
else:
|
||||||
msg = "{0} You are currently banned, appeal on the subreddit.".format(message.author.mention)
|
msg = "{0} You are currently banned, appeal on the subreddit.".format(message.author.mention)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue