From d3a1cd063f0daf1927111898f535ab38dd99b784 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Mon, 10 Dec 2018 14:58:53 -0600 Subject: [PATCH] Added settings for appeal link and allowed a list of roles to get new members. --- api/bot.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/api/bot.py b/api/bot.py index 91a4ad7..52c35ec 100644 --- a/api/bot.py +++ b/api/bot.py @@ -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