Added settings for appeal link and allowed a list of roles to get new members.

reminder
Joey Hines 2018-12-10 14:58:53 -06:00
parent fdb51af5c2
commit d3a1cd063f
1 changed files with 11 additions and 6 deletions

View File

@ -15,7 +15,8 @@ class Discord(discord.Client):
prefix = getattr(settings, 'DISCORD_BOT_PREFIX', '!')
auth_roles = getattr(settings, 'DISCORD_BOT_ROLES', [])
error_users = getattr(settings, 'DISCORD_ERROR_USERS', [])
member_role = getattr(settings, 'DISCORD_BOT_MEMBER_ROLE', 'Member')
new_member_roles = getattr(settings, 'DISCORD_BOT_NEW_MEMBER_ROLES', [])
appeal_self = getattr(settings, 'DISCORD_BOT_APPEAL_LINK', None)
token = None
def __init__(self, token, **kwargs):
@ -79,15 +80,19 @@ class Discord(discord.Client):
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)
for role_id in self.new_member_roles:
role = discord.utils.get(message.server.roles, id=role_id)
yield from self.add_roles(message.author, role)
msg = "Successfully added {0} as a member".format(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)
else:
msg = "{0} You are currently banned, appeal on the subreddit.".format(message.author.mention)
if self.appeal_self is None:
msg = "{0} You are currently banned, please appeal here: <{1}>".format(message.author.mention, self.appeal_link)
else:
msg = "{0} You are currently banned, please appeal."
yield from self.discord_message(message.channel, msg)
return