Skip to content
This repository was archived by the owner on Apr 6, 2026. It is now read-only.

feat(wow): add crafter mention to crafting order completion DM#305

Merged
karaktaka merged 2 commits into
mainfrom
feature/crafting-order-crafter-in-dm
Mar 8, 2026
Merged

feat(wow): add crafter mention to crafting order completion DM#305
karaktaka merged 2 commits into
mainfrom
feature/crafting-order-crafter-in-dm

Conversation

@karaktaka
Copy link
Copy Markdown
Contributor

@karaktaka karaktaka commented Mar 8, 2026

When a crafting order is marked as completed, the DM sent to the requester now includes a mention of the crafter who fulfilled it.

Changes

  • CompleteOrderButton.callback: reads CrafterId from the order and passes it as crafter=<@id> to the completion DM template
  • lang_en.yaml: dm_complete updated to "Your crafting order for **{item}** has been completed by {crafter}! 🎉"
  • lang_de.yaml: dm_complete updated to "Dein Handwerksauftrag für **{item}** wurde von {crafter} abgeschlossen! 🎉"

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Localization

    • Crafting order completion messages now include the crafter's name; various messages and dialogs reformatted for improved readability (queue headers, status updates, conversation prompts).
  • New Features

    • Automatic cleanup of DM-fallback threads for crafting orders.
    • Guild-configurable delay for when fallback messages are removed (default retained).

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 8, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Adds crafter attribution to crafting-complete messages, records DM-fallback thread deletion times on orders, provides a background cleanup loop to delete those messages/threads and clears the timestamp, and introduces a DB migration and model fields to support cleanup configuration and scheduling. (≤50 words)

Changes

Cohort / File(s) Summary
Localization
NerdyPy/locales/lang_en.yaml, NerdyPy/locales/lang_de.yaml
Added {crafter} placeholder to crafting order completion messages; other EN formatting/emoji text edits.
Crafting order view
NerdyPy/modules/views/crafting_order.py
Extract crafter id/mention, pass crafter into DM and thread-fallback messages; set MessageDeleteAt when thread fallback used; ensure timing set before final response edits.
Models & DB
NerdyPy/models/wow.py, database-migrations/versions/008_add_crafting_order_cleanup.py
Added CraftingBoardConfig.ThreadCleanupDelayHours (Integer, default 24) and CraftingOrder.MessageDeleteAt (DateTime, nullable); migration adds/removes these columns.
Background cleanup task
NerdyPy/modules/wow.py
New crafting cleanup loop: queries CraftingOrder.get_pending_cleanup(), deletes associated messages/threads via Discord API, clears MessageDeleteAt, logs and notifies on errors; loop started/stopped with cog.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant CleanupLoop as CleanupLoop (Cog)
participant DB as Database
participant BotAPI as Discord API (Bot)
participant Logger as Logger/Notify
CleanupLoop->>DB: get_pending_cleanup()
DB-->>CleanupLoop: list of orders with MessageDeleteAt due
loop each order
CleanupLoop->>BotAPI: fetch message(order.channel_id, order.message_id)
alt message found
CleanupLoop->>BotAPI: delete message
alt thread exists
CleanupLoop->>BotAPI: delete thread
end
CleanupLoop->>DB: set order.MessageDeleteAt = NULL
else message not found / errors
CleanupLoop->>Logger: log / notify_error
end
end

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through code with careful paws,
Added names and set tidy laws.
Threads now vanish on scheduled cue,
Crafter credited — hip hooray — woohoo! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the primary change: adding crafter mention to crafting order completion DM. It is concise, specific, and clearly communicates the main objective.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/crafting-order-crafter-in-dm

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
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@NerdyPy/locales/lang_en.yaml`:
- Around line 692-696: The string value for the YAML key
channel_unreachable_description is exceeding the 120-character line length;
update it to use a folded scalar (>|) or otherwise wrap the long line so no
physical line exceeds 120 chars while keeping the same text and interpolation
placeholders ({form}, {guild}, {channel_id}); ensure indentation and quoting
remain valid for YAML and the key name channel_unreachable_description is
unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5b6de729-da89-4183-b0d4-dc28771b71e2

📥 Commits

Reviewing files that changed from the base of the PR and between a0a106e and 79d7126.

📒 Files selected for processing (3)
  • NerdyPy/locales/lang_de.yaml
  • NerdyPy/locales/lang_en.yaml
  • NerdyPy/modules/views/crafting_order.py

Comment on lines +692 to +696
channel_unreachable_description:
"Someone tried to submit an application for form **{form}** in **{guild}**, but the review channel (ID: `{channel_id}`) is not accessible to the bot.


The submission was not saved. Please check the channel permissions or reconfigure the form."
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Wrap Line 693 to stay within the 120-character limit.

The new text is fine, but Line 693 is still over the repo limit. A folded scalar keeps the same message while making the YAML compliant.

✂️ Proposed fix
-      channel_unreachable_description:
-        "Someone tried to submit an application for form **{form}** in **{guild}**, but the review channel (ID: `{channel_id}`) is not accessible to the bot.
-
-
-        The submission was not saved. Please check the channel permissions or reconfigure the form."
+      channel_unreachable_description: >-
+        Someone tried to submit an application for form **{form}** in **{guild}**,
+        but the review channel (ID: `{channel_id}`) is not accessible to the bot.
+
+        The submission was not saved. Please check the channel permissions or
+        reconfigure the form.

As per coding guidelines, **/*.{py,md,yaml,yml}: Line length: 120 characters.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
channel_unreachable_description:
"Someone tried to submit an application for form **{form}** in **{guild}**, but the review channel (ID: `{channel_id}`) is not accessible to the bot.
The submission was not saved. Please check the channel permissions or reconfigure the form."
channel_unreachable_description: >-
Someone tried to submit an application for form **{form}** in **{guild}**,
but the review channel (ID: `{channel_id}`) is not accessible to the bot.
The submission was not saved. Please check the channel permissions or
reconfigure the form.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@NerdyPy/locales/lang_en.yaml` around lines 692 - 696, The string value for
the YAML key channel_unreachable_description is exceeding the 120-character line
length; update it to use a folded scalar (>|) or otherwise wrap the long line so
no physical line exceeds 120 chars while keeping the same text and interpolation
placeholders ({form}, {guild}, {channel_id}); ensure indentation and quoting
remain valid for YAML and the key name channel_unreachable_description is
unchanged.

Comment thread NerdyPy/modules/wow.py Fixed
@karaktaka karaktaka force-pushed the feature/crafting-order-crafter-in-dm branch from 5a96493 to b6e1754 Compare March 8, 2026 14:21
@karaktaka karaktaka merged commit 162b3c5 into main Mar 8, 2026
7 of 8 checks passed
@karaktaka karaktaka deleted the feature/crafting-order-crafter-in-dm branch March 8, 2026 14:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant