Skip to content

Add embed Discord link mentions#197

Open
michaelmwu wants to merge 2 commits intomainfrom
michaelmwu/discord-embed-mentions
Open

Add embed Discord link mentions#197
michaelmwu wants to merge 2 commits intomainfrom
michaelmwu/discord-embed-mentions

Conversation

@michaelmwu
Copy link
Member

Description

Add embed-only Discord mention formatting for the Resume Parsed and CRM Updated embeds when a Discord link target is present.
Extract the shared formatting into ResumeUpdateConfirmationView so both embeds render <@user_id> (username) consistently.

Related Issue

None.

How Has This Been Tested?

uv run pytest tests/unit/test_crm.py -q
uv run ruff check apps/discord_bot/src/five08/discord_bot/cogs/crm.py tests/unit/test_crm.py

Copilot AI review requested due to automatic review settings March 9, 2026 19:58
@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

Warning

Rate limit exceeded

@michaelmwu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 25 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1bbc90e9-ca63-4933-95a5-6ce167676c06

📥 Commits

Reviewing files that changed from the base of the PR and between 7ce01d1 and 6fe7db6.

📒 Files selected for processing (2)
  • apps/discord_bot/src/five08/discord_bot/cogs/crm.py
  • tests/unit/test_crm.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch michaelmwu/discord-embed-mentions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds consistent Discord “link target” mention formatting to CRM-related embeds by centralizing the formatting logic in ResumeUpdateConfirmationView, and expands unit coverage to validate the new embed output.

Changes:

  • Introduces a shared formatter for Discord link mentions (<@user_id> (username)) and uses it in both the “Resume Parsed” preview embed and “CRM Updated” success embed.
  • Refactors the “CRM Updated” embed construction into a dedicated _build_apply_success_embed helper.
  • Adds unit tests asserting the Discord link field includes both the <@id> mention and username.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
apps/discord_bot/src/five08/discord_bot/cogs/crm.py Adds shared Discord link formatting and applies it to preview + success embeds.
tests/unit/test_crm.py Adds tests validating the new Discord link mention formatting in embeds.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return None

mention = f"<@{user_id}>"
return f"{mention} ({username})" if username else mention
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_format_discord_link_value interpolates username directly into the embed field. If the stored username/display name contains @everyone, @here, or role/user mentions, this can trigger unwanted pings when the embed is sent. Consider sanitizing the username portion (e.g., discord.utils.escape_mentions(username); optionally also escape markdown) before formatting the final string, while leaving the <@id> mention intact if you want the user ping.

Suggested change
return f"{mention} ({username})" if username else mention
safe_username = discord.utils.escape_markdown(
discord.utils.escape_mentions(username)
)
return f"{mention} ({safe_username})" if username else mention

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants