Skip to content

Decode Discord /channels/ links offline #8

Description

@soxoj

Users report that https://discord.com/channels/<guild>/<channel>/<message> returns nothing. Same for /channels/@me/<id> DM links.

These can be decoded with no network request at all: the path segments are Discord snowflake IDs, and a snowflake carries its own creation timestamp. This is the same trick the existing t.me/c/ handling uses — copy its shape.

Extracts: guild id, channel id, message id, the timestamps derived from them, and a url_type saying what kind of link this is (guild message / DM / channel without message).

Explicitly not extracted: the author. This link shape does not contain it. The module must not imply otherwise, and the README row should say so.

Where the code goes

  • New module sharetrace/modules/discord_channels.py — one function, returns {"data": {...}} on success or {"error": "..."} on failure.
  • Register it in router.py: URL pattern plus an entry in PARSERS.
  • Add output labels in output.py.
  • Unit test in tests/test_unit_modules.py — copy the shape of TestTelegram.
  • Add a row to the supported-sources table in README.md.

How you verify it — no credentials, no network

pytest tests/ --ignore=tests/test_integration.py

Unit tests mock requests at the module level, so this runs fully offline. tests/test_integration.py hits the live network and is excluded on purpose.

Note: this repository has no CI. Run that command yourself before opening the PR — nothing will run it for you.

Done when

A /channels/ URL returns the three ids and their timestamps, a DM link returns the right url_type, the unit test covers a known snowflake, and the README row states what is and isn't available.

Out of scope

Anything requiring a Discord token, refactoring the router, other modules, new dependencies.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions