|
|
|
@ -325,17 +325,24 @@ async def on_member_join(member):
|
|
|
|
|
result = await cur.fetchone()
|
|
|
|
|
role_ids = result[5]
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
# Get Enso Chan
|
|
|
|
|
bot = guild.get_member(client.user.id)
|
|
|
|
|
|
|
|
|
|
# Check permissions of Enso
|
|
|
|
|
if bot.guild_permissions.manage_roles:
|
|
|
|
|
|
|
|
|
|
if role_ids is not None:
|
|
|
|
|
|
|
|
|
|
# Get all the roles of the user before they were muted from the database
|
|
|
|
|
roles = [member.guild.get_role(int(id_)) for id_ in role_ids.split(", ") if len(id_)]
|
|
|
|
|
|
|
|
|
|
# Give the member their roles back
|
|
|
|
|
await member.edit(roles=roles)
|
|
|
|
|
print(f"{member} Had Their Roles Given Back In {member.guild.name}")
|
|
|
|
|
else:
|
|
|
|
|
pass
|
|
|
|
|
except HTTPException:
|
|
|
|
|
print(f"Roles Could Not Be Added To {member} in {member.guild.name}")
|
|
|
|
|
else:
|
|
|
|
|
print(f"Insufficient Permissions to Add Roles to {member} in {member.guild.name}")
|
|
|
|
|
|
|
|
|
|
# Reset the roles entry for the database
|
|
|
|
|
update_query = """UPDATE members SET roles = NULL WHERE guildID = (%s) AND discordID = (%s)"""
|
|
|
|
@ -347,9 +354,7 @@ async def on_member_join(member):
|
|
|
|
|
print(cur.rowcount, f"Roles Cleared For {member} in {member.guild.name}")
|
|
|
|
|
|
|
|
|
|
# Make sure the guild is Enso
|
|
|
|
|
if guild.id != enso_guild_ID:
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
if guild.id == enso_guild_ID:
|
|
|
|
|
# Set the channel id to "newpeople"
|
|
|
|
|
new_people = guild.get_channel(enso_newpeople_ID)
|
|
|
|
|
|
|
|
|
|