update error handling for update_support_server_member_roles
@@ -30,7 +30,6 @@ class Database(commands.Cog):
@tasks.loop(minutes=10)
async def update_support_server_member_roles(self):
- try:
await self.bot.wait_until_ready()
support_guild = self.bot.get_guild(self.d.support_server_id)
@@ -39,6 +38,9 @@ class Database(commands.Cog):
for member in support_guild.members:
roles = []
+ if support_guild.get_member(member.id) is None:
+ continue
+
for role in member.roles:
if role.id not in role_map_values and role.id != self.d.support_server_id:
roles.append(role)
@@ -51,9 +53,10 @@ class Database(commands.Cog):
roles.append(support_guild.get_role(self.d.role_mappings.get('BOP')))
if roles != member.roles:
+ try:
await member.edit(roles=roles)
- except Exception as e:
- await self.bot.get_channel(self.d.error_channel_id).send(e)
+ except Exception:
+ pass
async def fetch_all_botbans(self):
async with self.db.acquire() as con:
