forked from Minecraft/minecraft_manager
Added settings for appeal link and allowed a list of roles to get new members.
parent
fdb51af5c2
commit
d3a1cd063f
17
api/bot.py
17
api/bot.py
|
@ -15,7 +15,8 @@ class Discord(discord.Client):
|
||||||
prefix = getattr(settings, 'DISCORD_BOT_PREFIX', '!')
|
prefix = getattr(settings, 'DISCORD_BOT_PREFIX', '!')
|
||||||
auth_roles = getattr(settings, 'DISCORD_BOT_ROLES', [])
|
auth_roles = getattr(settings, 'DISCORD_BOT_ROLES', [])
|
||||||
error_users = getattr(settings, 'DISCORD_ERROR_USERS', [])
|
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
|
token = None
|
||||||
|
|
||||||
def __init__(self, token, **kwargs):
|
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)
|
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:
|
else:
|
||||||
role = discord.utils.get(message.server.roles, name=self.member_role)
|
for role_id in self.new_member_roles:
|
||||||
msg = "Successfully added {0} as a {1}.".format(nickname, self.member_role)
|
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.change_nickname(message.author, nickname)
|
||||||
yield from self.add_roles(message.author, role)
|
|
||||||
yield from self.discord_message(message.channel, msg)
|
yield from self.discord_message(message.channel, msg)
|
||||||
else:
|
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)
|
yield from self.discord_message(message.channel, msg)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue