diff --git a/BOT/utils.py b/BOT/utils.py index 3e0c22e..6f1a5a9 100644 --- a/BOT/utils.py +++ b/BOT/utils.py @@ -986,19 +986,23 @@ async def resolve_clans(shorts: Optional[List[str]] = None, tags: Optional[List[ shorts = shorts or [] tags = tags or [] - # Process shorts first + # Process shorts first — only keep successful resolutions (clan_id present). + # Unresolved placeholders must not block the tag pass below, because some + # replays store the tagged form (e.g. "-DSPLA-") in the squadron field + # rather than the bare short name ("DSPLA"), causing the short lookup to + # miss even though the tag lookup would succeed. for short in shorts: if short: result = await resolve_clan(short=short) - if result: + if result and result.get("clan_id") is not None: results.append(result) - # Then process tags (for any not already resolved) + # Then process tags (for any not already resolved by a successful short lookup) resolved_shorts = {r["short_name"].lower() for r in results} for tag in tags: if tag and tag.lower() not in resolved_shorts: result = await resolve_clan(tag=tag) - if result: + if result and result.get("clan_id") is not None: results.append(result) return results