Skip to content

add /export_denicky slash command to export threads from deníčky channel#158

Open
benabraham wants to merge 4 commits intojuniorguru:mainfrom
benabraham:claude/discord-thread-export-command-4VP36
Open

add /export_denicky slash command to export threads from deníčky channel#158
benabraham wants to merge 4 commits intojuniorguru:mainfrom
benabraham:claude/discord-thread-export-command-4VP36

Conversation

@benabraham
Copy link
Copy Markdown

@benabraham benabraham commented Jan 29, 2026

Summary

Add /export_denicky slash command to export threads from the "deníčky" channel (ID: 1075087192101244928) to JSON format

Export includes all messages chronologically (oldest to newest) with usernames, not just IDs

Permission checks: only bot owner, moderators (manage_messages permission), or the thread author can export
Response is ephemeral (only visible to the user invoking the command)

Implementation

New files

  • src/jg/chick/lib/thread_export.py - Library module with export logic and permission checks
  • tests/test_lib_thread_export.py - 22 unit tests covering export functionality and permissions

Modified files

  • src/jg/chick/bot.py - Added the new slash command

JSON output format

{
  "id": 123456789,
  "name": "Thread name",
  "created_at": "2024-01-15T09:00:00+00:00",
  "messages": [
    {
      "id": 1,
      "author_id": 100,
      "author_name": "Username",
      "content": "Message text",
      "created_at": "2024-01-15T10:00:00+00:00"
    }
  ]
}

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

Adds a new module jg.chick.lib.thread_export implementing ExportedMessage and ExportedThread dataclasses, a DENICKY_CHANNEL_ID constant, and functions is_in_denicky_channel, can_export_thread, export_message, export_thread_messages, and export_thread to serialize threads and messages to JSON. Adds a slash command export_denicky in src/jg/chick/bot.py that validates thread context, checks permissions, exports the thread, and returns the JSON as an ephemeral file. Adds tests/test_lib_thread_export.py with extensive unit tests for channel checks, permission logic, serialization, and async export behavior.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a new /export_denicky slash command for exporting threads from the deníčky channel.
Description check ✅ Passed The description is well-structured and directly related to the changeset, providing implementation details, permission logic, and JSON output format.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

🧪 Unit Test Generation v2 is now available!

We have significantly improved our unit test generation capabilities.

To enable: Add this to your .coderabbit.yaml configuration:

reviews:
  finishing_touches:
    unit_tests:
      enabled: true

Try it out by using the @coderabbitai generate unit tests command on your code files or under ✨ Finishing Touches on the walkthrough!

Have feedback? Share your thoughts on our Discord thread!


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.

- remove unused thread parameter from can_export_thread
- fix owner_id edge case by using None instead of 0
- use asdict for ExportedThread.to_dict consistency
- add error handling for export failures in bot.py
- add async function tests for export_thread and export_thread_messages

https://claude.ai/code/session_01CVuMjC1r98SLQech7r19bA
- remove to_dict() methods, use asdict() directly in to_json()
- remove format_datetime(), use .isoformat() directly
- remove corresponding tests for removed functions

https://claude.ai/code/session_01CVuMjC1r98SLQech7r19bA
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