Restore link handling, add diagnostics, and harden downloads/shortenings#24
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||
💡 Codex ReviewLines 949 to 953 in 954a1df If ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
User description
Motivation
Description
!pingcommand to quickly verify the bot is receiving and responding to messages.on_messagelistener that processes commands, extracts URLs viaURL_REGEX, filters withis_valid_url/is_media_url, and forwards accepted links to a new_handle_linkworkflow wrapped in a try/except that logs full tracebacks._handle_linkto build a pending entry, calllink_previewandmake_verdict_embed, persist withstorage.add_pending_link, present aLinkActionView, update the pending entry with the bot message id, and increment guild pending counters.Content-LengthagainstMAX_DOWNLOAD_BYTES, ensuring allowed content types, and switching the TinyURL call tohttps; also emit a startup warning ifmessage_contentintent is disabled and improve command error logging.Testing
Codex Task
PR Type
Enhancement, Bug fix
Description
Restored link detection via
on_messagelistener with URL extraction and filteringAdded
!pingcommand for bot responsiveness diagnosticsHardened downloads by validating schemes, checking Content-Length, and verifying content types
Implemented
_handle_linkworkflow with verdict generation, embed creation, and storage persistenceAdded
!pendinglinkscommand to display user's pending linksSwitched TinyURL API to HTTPS and added message content intent warning at startup
Diagram Walkthrough
File Walkthrough
main.py
Link handling restoration with safety hardeningmain.py
download_bytesto reject non-HTTP(S) URLsMAX_DOWNLOAD_BYTESlimitshorten_link!pingcommand for bot diagnosticson_messagelistener that extracts URLs, filters withis_valid_url/is_media_url, and processes valid links_handle_linkmethod to generate verdicts, create embeds,store pending entries, and display action views
!pendinglinkscommand to retrieve and display user's pendinglinks