aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2025-07-16 10:19:05 +0100
committerGravatar Joe Banks <[email protected]>2025-07-16 10:19:05 +0100
commit96ef26c9fe481ce8fb5fe9b6cc6bb55422eb2efd (patch)
treeba47d14749bfe8ec187ffad5a885f3ca52483004
parentHandle users who have left in the LDAP sync utility (diff)
Correct string conversion and coroutine run
-rw-r--r--arthur/exts/directory/ldap.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/arthur/exts/directory/ldap.py b/arthur/exts/directory/ldap.py
index f2feb9e..3ea8e66 100644
--- a/arthur/exts/directory/ldap.py
+++ b/arthur/exts/directory/ldap.py
@@ -198,9 +198,11 @@ class LDAP(commands.Cog):
for user in diff:
await self._process_user(user, notified_users)
- handled.add(user.discord_user.id)
+ handled.add(
+ user.ldap_user.employee_number if user.ldap_user else str(user.discord_user.id)
+ )
- self._handle_left_users(handled)
+ await self._handle_left_users(handled)
logger.info("LDAP: Sync complete.")
except Exception as e: # noqa: BLE001
@@ -209,9 +211,9 @@ class LDAP(commands.Cog):
f":x: LDAP Sync Error: ```python\n{e}```"
)
- def _handle_left_users(self, handled: list[int]) -> None:
+ async def _handle_left_users(self, handled: list[int]) -> None:
"""Handle users that have left the guild and so were not processed."""
- ldap_users = ldap.find_users()
+ ldap_users = await ldap.find_users()
for user in ldap_users:
if user.employee_number is None or user.employee_number in handled: