Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Somnia Bot: add talent scalings to archive char command #2775

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

Godlander
Copy link
Contributor

@Godlander Godlander commented Feb 23, 2025

Describe your changes

add talent scalings to archive char command

Issue or discord link

https://discord.com/channels/785153694478893126/1220796004442312807

Testing/validation

image

Checklist before requesting a review (leave this PR as draft if any part of this list is not done.)

  • I have commented my code in hard-to understand areas.
  • I have made corresponding changes to README or wiki.
  • For front-end changes, I have updated the corresponding English translations.
  • I have run yarn run mini-ci locally to validate format and lint.
  • If I have added a new library or app, I have updated the deployment scripts to ignore changes as needed

Summary by CodeRabbit

  • New Features

    • Introduced a dropdown menu for selecting talent levels, providing dynamic detail display for character abilities.
    • Expanded character name options for the Traveler in various localizations, including Hydro and Pyro elements.
  • Refactor

    • Streamlined character and weapon data handling to improve consistency and performance.
    • Enhanced translation functionality by accepting additional customization options.
    • Standardized error messaging for clearer notifications.
  • Chores

    • Added a new command for easily serving the Somnia application.

Copy link
Contributor

coderabbitai bot commented Feb 23, 2025

Walkthrough

This pull request updates several command and library files to replace the old CharacterKey with the new CharacterSheetKey. Function parameter orders have been revised, including adjustments for talent level handling and improved error messaging. A new key conversion function (sheetKeyToCharKey) has been introduced, and custom formatter registration now uses a dedicated i18n instance. Additionally, a new script has been added to the package.json for serving the Somnia application via nx.

Changes

File(s) Change Summary
apps/somnia/src/commands/archive.ts
apps/somnia/src/commands/archive/char.ts
apps/somnia/src/commands/archive/weapon.ts
Replaced CharacterKey with CharacterSheetKey in variables and function signatures; updated parameter orders (e.g., moving lang position and adding level); refined error messages; and integrated dynamic elements (dropdown and slashcommand usage).
apps/somnia/src/commands/go/calculator.ts Updated import to use sheetKeyToCharKey and converted baseCharStats parameter from CharacterKey to CharacterSheetKey, ensuring proper key transformation.
libs/gi/consts/src/character.ts Added a new function sheetKeyToCharKey to convert a CharacterSheetKey to a CharacterKey, with special handling for keys containing "Traveler".
libs/gi/i18n-node/src/i18n.ts Updated formatter registration to use the instance variable i18nInstance instead of the default i18n object.
libs/gi/stats/src/index.ts Expanded getCharEle to accept both CharacterSheetKey and CharacterKey; introduced getCharParam and new types (CharacterSheetKey, NonTravelerCharacterKey).
package.json Added a new script "somnia": "nx serve somnia" to run the Somnia application via nx.

Sequence Diagram(s)

sequenceDiagram
    participant User as User/Discord
    participant ArchiveCmd as Archive Command Handler
    participant CharArchive as Character Archive Handler
    participant Converter as sheetKeyToCharKey Function
    participant UI as Dropdown Component

    User->>ArchiveCmd: Issue archive command (id, args, lang)
    ArchiveCmd->>CharArchive: Invoke charArchive(id, arg, lang)
    CharArchive->>Converter: Convert CharacterSheetKey to CharacterKey (if needed)
    Converter-->>CharArchive: Return converted key
    CharArchive->>UI: Render talent level dropdown (if applicable)
    UI-->>CharArchive: Return selected talent level
    CharArchive-->>ArchiveCmd: Return archive embed details
    ArchiveCmd-->>User: Display archive result
Loading

Suggested reviewers

  • frzyc

Poem

In the depths of code, I toil and spin,
Keys transformed, let the new age begin.
Functions dance, parameters align,
In the realm of Somnia, our dreams intertwine.
With every line, a story unfolds,
A sleepless ode, in the night it beholds.
🌙💻

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

github-actions bot commented Feb 23, 2025

[zzz-frontend] [Sun Feb 23 02:12:19 UTC 2025] - Deployed 07a6e95 to https://genshin-optimizer-prs.github.io/pr/2775/zzz-frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Sun Feb 23 02:12:41 UTC 2025] - Deployed 07a6e95 to https://genshin-optimizer-prs.github.io/pr/2775/sr-frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Sun Feb 23 02:13:29 UTC 2025] - Deployed 07a6e95 to https://genshin-optimizer-prs.github.io/pr/2775/frontend (Takes 3-5 minutes after this completes to be available)

[zzz-frontend] [Sun Feb 23 02:14:43 UTC 2025] - Deployed 59b8d70 to https://genshin-optimizer-prs.github.io/pr/2775/zzz-frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Sun Feb 23 02:15:01 UTC 2025] - Deployed 59b8d70 to https://genshin-optimizer-prs.github.io/pr/2775/sr-frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Sun Feb 23 02:15:12 UTC 2025] - Deployed 59b8d70 to https://genshin-optimizer-prs.github.io/pr/2775/frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Sun Feb 23 02:16:40 UTC 2025] - Deployed 4a82d8f to https://genshin-optimizer-prs.github.io/pr/2775/sr-frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Sun Feb 23 02:16:52 UTC 2025] - Deployed 4a82d8f to https://genshin-optimizer-prs.github.io/pr/2775/frontend (Takes 3-5 minutes after this completes to be available)

[zzz-frontend] [Sun Feb 23 02:17:05 UTC 2025] - Deployed 4a82d8f to https://genshin-optimizer-prs.github.io/pr/2775/zzz-frontend (Takes 3-5 minutes after this completes to be available)

[zzz-frontend] [Sun Feb 23 04:31:36 UTC 2025] - Deployed bcab416 to https://genshin-optimizer-prs.github.io/pr/2775/zzz-frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Sun Feb 23 04:31:41 UTC 2025] - Deployed bcab416 to https://genshin-optimizer-prs.github.io/pr/2775/sr-frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Sun Feb 23 04:31:56 UTC 2025] - Deployed bcab416 to https://genshin-optimizer-prs.github.io/pr/2775/frontend (Takes 3-5 minutes after this completes to be available)

[zzz-frontend] [Sun Feb 23 04:42:08 UTC 2025] - Deployed 6b0522c to https://genshin-optimizer-prs.github.io/pr/2775/zzz-frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Sun Feb 23 04:42:35 UTC 2025] - Deployed 6b0522c to https://genshin-optimizer-prs.github.io/pr/2775/frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Sun Feb 23 04:44:03 UTC 2025] - Deployed 6b0522c to https://genshin-optimizer-prs.github.io/pr/2775/sr-frontend (Takes 3-5 minutes after this completes to be available)

[zzz-frontend] [Sun Feb 23 05:07:05 UTC 2025] - Deployed 1ca9bbe to https://genshin-optimizer-prs.github.io/pr/2775/zzz-frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Sun Feb 23 05:07:12 UTC 2025] - Deployed 1ca9bbe to https://genshin-optimizer-prs.github.io/pr/2775/sr-frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Sun Feb 23 05:07:25 UTC 2025] - Deployed 1ca9bbe to https://genshin-optimizer-prs.github.io/pr/2775/frontend (Takes 3-5 minutes after this completes to be available)

[zzz-frontend] [Sun Feb 23 10:42:38 UTC 2025] - Deployed 228169e to https://genshin-optimizer-prs.github.io/pr/2775/zzz-frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Sun Feb 23 10:42:52 UTC 2025] - Deployed 228169e to https://genshin-optimizer-prs.github.io/pr/2775/frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Sun Feb 23 10:44:27 UTC 2025] - Deployed 228169e to https://genshin-optimizer-prs.github.io/pr/2775/sr-frontend (Takes 3-5 minutes after this completes to be available)

Copy link
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: 0

🧹 Nitpick comments (8)
apps/somnia/src/commands/archive/char.ts (5)

26-95: Refactor to streamline code and add input checks in getEmbed.

  • This function handles multiple responsibilities: parsing level, building dropdown, deciding embed. Splitting into smaller helper functions might help my already-foggy head and future maintainers.
  • Consider validating arg more thoroughly (e.g., numeric check) to avoid potential pitfalls.
🧰 Tools
🪛 ESLint

[error] 32-32: 'res' is never reassigned. Use 'const' instead.

(prefer-const)


32-32: Prefer const over let.
ESLint is yelling you to treat res as const since it's never reassigned. My tired mind resonates with the lint.

- let res: { embed: EmbedBuilder; components: AnyComponentBuilder[] } = {
+ const res: { embed: EmbedBuilder; components: AnyComponentBuilder[] } = {
    embed: {} as EmbedBuilder,
    components: [],
}
🧰 Tools
🪛 ESLint

[error] 32-32: 'res' is never reassigned. Use 'const' instead.

(prefer-const)


39-58: Simplify condition 'neq'.includes(arg[0]).
Using 'neq'.includes(arg[0]) to filter those talents can be a bit cryptic. Consider a small set check for clarity. A sleepless dev in the future might thank you.


123-160: Use const for scalings.
ESLint’s complaint about reassigning resonates with my own exhaustion. It's never changed, so let’s keep it const.

- let scalings: Record<string, number> = {}
+ const scalings: Record<string, number> = {}
🧰 Tools
🪛 ESLint

[error] 131-131: 'scalings' is never reassigned. Use 'const' instead.

(prefer-const)


280-287: selectPassive logic.
This is understandable, though a bit magical (1 => A1, 4 => A4). Maybe a quick doc/comment to help us sleepless devs.

libs/gi/consts/src/character.ts (1)

250-254: Add input validation to sheetKeyToCharKey.

Yawns While the function works, it could use some defensive programming...

 export function sheetKeyToCharKey(sheetKey: CharacterSheetKey): CharacterKey {
+  if (!allCharacterSheetKeys.includes(sheetKey)) {
+    throw new Error(`Invalid CharacterSheetKey: ${sheetKey}`);
+  }
   if (sheetKey.includes('Traveler'))
     return sheetKey.slice(0, -1) as CharacterKey
   else return sheetKey as CharacterKey
 }
apps/somnia/src/commands/archive.ts (2)

201-204: Error handling looks good but could be more informative.

Sips coffee The error messages are now consistent, but we could provide more helpful feedback...

-    if (!archive[subcommand].includes(id as CharacterSheetKey))
-      throw 'Invalid character name'
+    if (!archive[subcommand].includes(id as CharacterSheetKey))
+      throw `Invalid character name: "${id}". Please use the autocomplete to select a valid character.`

140-147: Simplify the regex in clean function.

Rubs eyes The regex for handling italics could be simplified...

-  //italics become small
-  s = s.replace(/(<i>[\s\S]*)\n([\s\S]*<\/i>)/g, (m) =>
-    m.replace(/\n/g, '\n-# ')
-  )
-  s = s.replaceAll(/(<i>)+/g, '*-# ')
+  //handle multi-line italics
+  s = s.replace(/<i>([\s\S]*?)<\/i>/g, (_, content) => 
+    '*-# ' + content.replace(/\n/g, '\n-# ') + '*'
+  )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 49b4339 and f1aa63c.

📒 Files selected for processing (9)
  • apps/somnia/src/commands/archive.ts (6 hunks)
  • apps/somnia/src/commands/archive/char.ts (8 hunks)
  • apps/somnia/src/commands/archive/weapon.ts (2 hunks)
  • apps/somnia/src/commands/go/calculator.ts (3 hunks)
  • libs/gi/consts/src/character.ts (1 hunks)
  • libs/gi/dm-localization/src/executors/gen-locale/executor.ts (1 hunks)
  • libs/gi/i18n-node/src/i18n.ts (1 hunks)
  • libs/gi/stats/src/index.ts (3 hunks)
  • package.json (1 hunks)
🧰 Additional context used
🪛 ESLint
apps/somnia/src/commands/archive/char.ts

[error] 32-32: 'res' is never reassigned. Use 'const' instead.

(prefer-const)


[error] 131-131: 'scalings' is never reassigned. Use 'const' instead.

(prefer-const)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: lint
🔇 Additional comments (26)
apps/somnia/src/commands/archive/char.ts (16)

3-14: No immediate concerns with updated import references.
Heh, I haven't slept for three days, but these imports look consistent with the new CharacterSheetKey approach. No red flags here.


23-23: Import usage is straightforward.
It's just pulling in what we need. My eyes can stay half-closed with no issues here.


36-38: Potential input validation check for parseInt.
If arg is malformed, parseInt might cause me a headache. A quick protective check would be nice.


60-92: Comprehensive if-else chain.
All branches for p, n, e, q, a, c are logically correct. Just keep an eye on expansions if more talents get introduced.


94-94: Return statement is straightforward.
No extra concerns—this is neat and tidy.


97-101: Proper traveler handling in getAssets.
Good fallback logic for traveler characters. Nothing keeps me awake here.


104-106: Naming looks consistent in getName.
Just a quick check: watch out for missing translations. Otherwise, all good.


108-121: baseEmbed effectively sets up the embed.
It’s straightforward. Love seeing fallback icons. No glaring issues from a bleary set of eyes.


123-160: talentFields logic is sound but could be more defensive.
A small check on level range (e.g., >=1 && <= params[key].length) might help mitigate weird user inputs.

🧰 Tools
🪛 ESLint

[error] 131-131: 'scalings' is never reassigned. Use 'const' instead.

(prefer-const)


162-199: profileEmbed usage is correct.
Nicely populates base stats and descriptions. The formatting approach is consistent—no immediate concerns.


201-231: normalsEmbed with level param.
This is a good example of hooking into the talentFields. The approach is clean. If I'm half-awake, I can still follow it.


233-255: skillEmbed is consistent with normalsEmbed.
Maintains the same patterns. Clean usage of talentFields for skill scaling.


257-278: burstEmbed parallels the skill approach.
Same pattern, no big concerns. Just keep an eye out for expansions or edge cases.


289-315: passivesEmbed checks out.
Appropriately fetches passives by ascension rank. The text formatting is clear enough.


317-348: constellationsEmbed with level checks.
Throwing an error on out-of-range constellations is a nice sanity check. If only I had that for my schedule.


350-384: charArchive sets up i18n and returns final embed with dropdown.
This is well structured; the multi-menu approach is a bit heavy, but workable.

libs/gi/i18n-node/src/i18n.ts (1)

49-54: Switching formatter registration to i18nInstance is correct.
All good—keeps the formatters pinned to our new instance. My sleep-deprived self approves.

libs/gi/stats/src/index.ts (3)

4-6: New type imports recognized.
CharacterSheetKey and NonTravelerCharacterKey expansions look good to me, though my coffee cup is empty.


24-31: Improved getCharEle logic for traveler detection.
Condensing these into if-else checks is straightforward. Just watch out if we add more elements in the future.


40-42: getCharParam is a clean addition.
Directly returning skillParam by key is simple and effective—my insomniac brain welcomes that clarity.

apps/somnia/src/commands/go/calculator.ts (2)

1-7: LGTM! Import changes look good.

The addition of sheetKeyToCharKey import and type updates align with the new character key system.


25-36: LGTM! Parameter type update is correct.

The baseCharStats function now properly handles CharacterSheetKey and converts it to CharacterKey before passing to charData.

apps/somnia/src/commands/archive/weapon.ts (2)

42-42: Nice improvement using dynamic command name!

Using ${slashcommand.name} instead of hardcoded 'archive weapon' makes the code more maintainable.


49-49:

✅ Verification successful

Verify parameter order consistency across codebase.

The parameter order has changed from (id, lang, args) to (id, args, lang). Need to ensure all call sites are updated.


🏁 Script executed:

#!/bin/bash
# Search for weaponArchive function calls
rg -A 2 "weaponArchive\(" 

Length of output: 519


Parameter order for weaponArchive verified as correct across the codebase.

  • The implementation in apps/somnia/src/commands/archive/weapon.ts now uses the new order (id, args, lang).
  • The call site in apps/somnia/src/commands/archive.ts correctly passes parameters as (id as WeaponKey, arg, lang).

No further changes are needed.

libs/gi/dm-localization/src/executors/gen-locale/executor.ts (1)

420-427:

✅ Verification successful

LGTM! yawns Just need to verify the element order...

The addition of Hydro and Pyro elements looks good, matching the game's progression. Though my sleep-deprived brain wants to make sure the order matches the game's element introduction sequence.


🌐 Web query:

What is the chronological order of Traveler's elements in Genshin Impact?

💡 Result:

The Traveler in Genshin Impact gains elemental abilities chronologically based on story progression and region exploration. Here's the confirmed order of elemental unlocks:

Chronological Element Acquisition

  1. Anemo

    • Unlocked automatically during the prologue in Mondstadt via interaction with a Statue of The Seven[1][2].
  2. Geo

    • Acquired in Liyue by resonating with a Geo Statue of The Seven[1][2].
  3. Electro

    • Obtained in Inazuma after completing Chapter II: Act I and interacting with an Electro Statue[1][2][8].
  4. Dendro

    • Unlocked in Sumeru by resonating with a Dendro Statue after reaching Chapter III[2][8][9].
  5. Hydro

    • Gained in Fontaine via Hydro Statues during Chapter IV’s story[2][8].
  6. Pyro (Pending Release)

    • Expected to debut with Natlan’s release (Chapter V)[1][8]. Recent leaks suggest partial access via story quests but no full resonance yet[6].
  7. Cryo (Pending Release)

    • Likely tied to Snezhnaya’s release (Chapter VI)[1][8].

Notes on Elemental Progression

  • Each element corresponds to a region’s Archon and unlocks via Statues of The Seven after advancing the main story[1][2].
  • The sequence aligns with Archon Quest chapters: Mondstadt (Prologue), Liyue (Chapter I), Inazuma (Chapter II), etc.[8].
  • Pyro’s implementation remains unique: early access via specific quest mechanics exists[6], but full resonance requires Natlan’s release[1][8].

This order reflects both gameplay mechanics and narrative structure[1][8]. Future updates will expand this list as new regions launch.

Citations:


Element Order Verified and Ready to Roll!

The updated array—['Anemo', 'Geo', 'Electro', 'Dendro', 'Hydro', 'Pyro']—aligns perfectly with the in-game progression for the Traveler's elemental unlocks. According to the latest sources, the order is: Anemo, Geo, Electro, Dendro, Hydro, then Pyro (with Cryo still pending). Nice work adding Hydro and Pyro; just keep an eye on any future changes once Pyro's full resonance kicks in.

package.json (1)

8-8: Looks good! sips coffee Finally, a dedicated script for Somnia.

The new script follows the same pattern as the frontend command. Perfect for those late-night debugging sessions.

Copy link
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

🧹 Nitpick comments (1)
apps/somnia/src/commands/archive/char.ts (1)

36-58: Consider making talent level defaults configurable.
Sometimes I'm so sleepy that I forget which talent level is the default. If 10 is just a placeholder, maybe store it in a constant or config for clarity.

- if (isNaN(level)) level = 10
+ const DEFAULT_TALENT_LEVEL = 10
+ if (isNaN(level)) level = DEFAULT_TALENT_LEVEL
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f1aa63c and 9a51bbf.

📒 Files selected for processing (17)
  • apps/somnia/src/commands/archive.ts (6 hunks)
  • apps/somnia/src/commands/archive/char.ts (8 hunks)
  • libs/gi/dm-localization/assets/locales/chs/charNames_gen.json (1 hunks)
  • libs/gi/dm-localization/assets/locales/cht/charNames_gen.json (1 hunks)
  • libs/gi/dm-localization/assets/locales/de/charNames_gen.json (1 hunks)
  • libs/gi/dm-localization/assets/locales/en/charNames_gen.json (1 hunks)
  • libs/gi/dm-localization/assets/locales/es/charNames_gen.json (1 hunks)
  • libs/gi/dm-localization/assets/locales/fr/charNames_gen.json (1 hunks)
  • libs/gi/dm-localization/assets/locales/id/charNames_gen.json (1 hunks)
  • libs/gi/dm-localization/assets/locales/it/charNames_gen.json (1 hunks)
  • libs/gi/dm-localization/assets/locales/ja/charNames_gen.json (1 hunks)
  • libs/gi/dm-localization/assets/locales/ko/charNames_gen.json (1 hunks)
  • libs/gi/dm-localization/assets/locales/pt/charNames_gen.json (1 hunks)
  • libs/gi/dm-localization/assets/locales/ru/charNames_gen.json (1 hunks)
  • libs/gi/dm-localization/assets/locales/th/charNames_gen.json (1 hunks)
  • libs/gi/dm-localization/assets/locales/tr/charNames_gen.json (1 hunks)
  • libs/gi/dm-localization/assets/locales/vi/charNames_gen.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • libs/gi/dm-localization/assets/locales/en/charNames_gen.json
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: lint
  • GitHub Check: call-build / build
🔇 Additional comments (32)
apps/somnia/src/commands/archive/char.ts (1)

3-5: All import changes seem okay.
Ugh, my eyes are stinging around midnight, but I don't see any issues with these imports—the shift to CharacterSheetKey is consistent.

Also applies to: 9-14, 23-23

apps/somnia/src/commands/archive.ts (3)

20-20: New references to character sheet keys look consistent.
Can't avoid a yawn, but everything aligns with the refactor to allCharacterSheetKeys and CharacterSheetKey. Thumbs up.

Also applies to: 22-22, 107-110


117-118: Optional options parameter in translate seems fine.
Looks good for passing additional data to i18n. I'm running on fumes, so no concerns here.


197-205: Parameter reordering in archiveMessage is consistent with the rest.
No breaks spotted; if it compiles, I can finally catch some z's.

libs/gi/dm-localization/assets/locales/cht/charNames_gen.json (2)

102-103: New Localization Entries for Female Traveler (Traditional Chinese)
These two new entries for TravelerHydroF ("熒 (水元素)") and TravelerPyroF ("熒 (火)") are correctly inserted and follow the established naming convention. They look spot on and won’t keep me up any longer tonight.


108-109: New Localization Entries for Male Traveler (Traditional Chinese)
The additions of TravelerHydroM ("空 (水元素)") and TravelerPyroM ("空 (火)") are properly defined. The translation style is consistent with the other entries in this file.

libs/gi/dm-localization/assets/locales/chs/charNames_gen.json (2)

102-103: New Localization Entries for Female Traveler (Simplified Chinese)
The entries TravelerHydroF: "荧 (水元素)" and TravelerPyroF: "荧 (火)" have been added correctly. They match our simplified Chinese style perfectly, which is a relief on an already long night.


108-109: New Localization Entries for Male Traveler (Simplified Chinese)
TravelerHydroM: "空 (水元素)" and TravelerPyroM: "空 (火)" are present and consistent with the file’s overall approach. Everything seems in order—finally, some good news before I crash.

libs/gi/dm-localization/assets/locales/ja/charNames_gen.json (2)

102-103: New Localization Entries for Female Traveler (Japanese)
The additions TravelerHydroF: "蛍 (水元素)" and TravelerPyroF: "蛍 (炎)" follow the expected naming pattern for Japanese. It’s soothing to see these proper translations after a jittery caffeine-fueled night.


108-109: New Localization Entries for Male Traveler (Japanese)
The entries TravelerHydroM: "空 (水元素)" and TravelerPyroM: "空 (炎)" also fit nicely with the existing format. Everything looks coherent, letting me finally close my eyes a bit easier.

libs/gi/dm-localization/assets/locales/ko/charNames_gen.json (2)

102-103: New Localization Entries for Female Traveler (Korean)
The new keys TravelerHydroF: "루미네 (물 원소)" and TravelerPyroF: "루미네 (불)" are correctly added and consistent with our Korean localization standards. Even my bleary eyes can confirm their correctness.


108-109: New Localization Entries for Male Traveler (Korean)
Similarly, TravelerHydroM: "아이테르 (물 원소)" and TravelerPyroM: "아이테르 (불)" are well-formulated and match the file’s format impeccably. I’m almost ready to hit the pillow now.

libs/gi/dm-localization/assets/locales/ru/charNames_gen.json (2)

102-103: New Localization Entries for Female Traveler (Russian)
The additions TravelerHydroF: "Люмин (Гидро)" and TravelerPyroF: "Люмин (Пиро)" are correctly implemented. The translations align with the localized style in Russian and they certainly help make the night a bit less dreary.


108-109: New Localization Entries for Male Traveler (Russian)
The entries TravelerHydroM: "Итэр (Гидро)" and TravelerPyroM: "Итэр (Пиро)" are properly added and consistent with the other language variants. Everything looks great, and I can finally dream in proper Russian localization tonight.

libs/gi/dm-localization/assets/locales/th/charNames_gen.json (2)

102-103: New Female Traveler Entries – Thai
Ugh, my eyes are half-closed, but these new entries for "TravelerHydroF": "Lumine (น้ำ)" and "TravelerPyroF": "Lumine (ไฟ)" look consistent with the intended Thai translations for water and fire. Just double-check that these keys match the naming conventions used in the other locale files.


108-109: New Male Traveler Entries – Thai
These additions for "TravelerHydroM": "Aether (น้ำ)" and "TravelerPyroM": "Aether (ไฟ)" are in line with the female entries, ensuring consistency in the Thai localization. Even when I'm barely awake, consistency is key!

libs/gi/dm-localization/assets/locales/es/charNames_gen.json (2)

102-103: New Female Traveler Entries – Spanish
I’m running on caffeine and code, but I can see that "TravelerHydroF": "Lumina (Hydro)" and "TravelerPyroF": "Lumina (Pyro)" have been added. They follow the pattern nicely—just make sure “Hydro” and “Pyro” are exactly as intended in the Spanish translation context.


108-109: New Male Traveler Entries – Spanish
The new "TravelerHydroM": "Éter (Hydro)" and "TravelerPyroM": "Éter (Pyro)" entries look good. Even though my brain’s foggy, these seem to be consistent with the naming style elsewhere in the Spanish locale.

libs/gi/dm-localization/assets/locales/de/charNames_gen.json (2)

102-103: New Female Traveler Entries – German
So, "TravelerHydroF": "Lumine (Hydro)" and "TravelerPyroF": "Lumine (Pyro)" have been introduced. They’re straightforward and match the format of the other entries. Just a heads-up: in German, sometimes leaving “Hydro” and “Pyro” untranslated is intentional, but it’s worth a quick re‑check if that’s what the translators intended.


108-109: New Male Traveler Entries – German
I see the entries "TravelerHydroM": "Leer (Hydro)" and "TravelerPyroM": "Leer (Pyro)" have been added. Note that "Leer" means “empty” in German—please confirm that this is the intended localization rather than, say, a direct transcription of a name like “Aether”.

libs/gi/dm-localization/assets/locales/vi/charNames_gen.json (2)

102-103: New Female Traveler Entries – Vietnamese
Despite my perpetual sleep deficit, I can confirm that "TravelerHydroF": "Lumine (Thủy)" and "TravelerPyroF": "Lumine (Hỏa)" correctly add the water and fire designators in Vietnamese. Looks good!


108-109: New Male Traveler Entries – Vietnamese
The entries "TravelerHydroM": "Aether (Thủy)" and "TravelerPyroM": "Aether (Hỏa)" for the male traveler are consistent with their female counterparts. As far as I can tell between my yawns, everything’s in order.

libs/gi/dm-localization/assets/locales/tr/charNames_gen.json (2)

102-103: New Female Traveler Entries – Turkish
Even in my sleepless haze, I can see that "TravelerHydroF": "Lumine (Su)" and "TravelerPyroF": "Lumine (Ateş)" have been correctly added. They adhere to the Turkish localization conventions, so kudos on that!


108-109: New Male Traveler Entries – Turkish
The entries "TravelerHydroM": "Aether (Su)" and "TravelerPyroM": "Aether (Ateş)" also look properly configured. Everything seems consistent with the rest of the file—even if my brain’s too tired to notice every little detail.

libs/gi/dm-localization/assets/locales/pt/charNames_gen.json (2)

102-103: New Traveler Female Hydro & Pyro Localization
Gah, my eyes are twitching from too many caffeine shots, but these new entries—
"TravelerHydroF": "Lumine (Hydro)" and "TravelerPyroF": "Lumine (Pyro)"
look perfectly in line with our existing style. Nice, clean, and consistent!


108-109: New Traveler Male Hydro & Pyro Localization
Even in my sleep-deprived state, I can confirm that "TravelerHydroM": "Aether (Hydro)" and
"TravelerPyroM": "Aether (Pyro)" are spot-on. They mesh well with the rest of the mappings.

libs/gi/dm-localization/assets/locales/fr/charNames_gen.json (2)

102-103: Additional French Traveler Localization Entries for Female
I know, I’ve been up for hours debugging obscure issues, but even my bleary eyes see that adding
"TravelerHydroF": "Lumine (Hydro)" and "TravelerPyroF": "Lumine (Pyro)" fits seamlessly with our French keys.


108-109: Additional French Traveler Localization Entries for Male
The additions "TravelerHydroM": "Aether (Hydro)" and "TravelerPyroM": "Aether (Pyro)" are as crisp as my need for sleep.
Great work keeping it consistent.

libs/gi/dm-localization/assets/locales/id/charNames_gen.json (2)

102-103: New Indonesian Traveler Female Localization Keys
Even after a long night, I can see that "TravelerHydroF": "Lumine (Hydro)" and "TravelerPyroF": "Lumine (Pyro)" have been added correctly. Everything’s on par with our other locales.


108-109: New Indonesian Traveler Male Localization Keys
The new mappings "TravelerHydroM": "Aether (Hydro)" and "TravelerPyroM": "Aether (Pyro)" look just right.
Keep those localization vibes consistent, please!

libs/gi/dm-localization/assets/locales/it/charNames_gen.json (2)

102-103: New Italian Traveler Female Localization Keys
"TravelerHydroF": "Lumine (Hydro)" and "TravelerPyroF": "Lumine (Pyro)" nicely extend the Italian localization for our Traveler characters without breaking our style.


108-109: New Italian Traveler Male Localization Keys
The added "TravelerHydroM": "Aether (Hydro)" and "TravelerPyroM": "Aether (Pyro)" are as clear as my insomnia-fueled thoughts. They’re consistent, and all seems well.

Comment on lines +71 to +92
else if (arg[0] === 'c') {
res.embed = constellationsEmbed(id, namespace, level, lang)

//create dropdown menu
const options = []
for (const cl of [0, 1, 2, 3, 4, 5, 6]) {
const label = cl ? 'Constellation ' + cl : 'All Constellations'
const value = cl ? 'c' + cl : 'c'
const menu = new StringSelectMenuOptionBuilder()
.setLabel(label)
.setValue(value)
if (value == arg) menu.setDefault(true)
options.push(menu)
}
const label = level ? 'Constellation ' + level : 'All Constellations'
res.components = [
new StringSelectMenuBuilder()
.setCustomId(`${slashcommand.name} char ${id} ${arg} ${lang} 1`)
.setPlaceholder(label)
.addOptions(options),
]
} else throw 'Invalid talent name.'
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix the 'All Constellations' conflict.
If level is NaN when choosing "All Constellations," constellationsEmbed throws "Invalid constellation." Suggest allowing level = 0 to bypass the error-check or refine the condition.

--- a/apps/somnia/src/commands/archive/char.ts
+++ b/apps/somnia/src/commands/archive/char.ts
@@ -72,7 +72,13 @@ else if (arg[0] === 'c') {
   res.embed = constellationsEmbed(id, namespace, level, lang)

   // ...
-  if (value == arg) menu.setDefault(true)
+  // If arg.length === 1 => "c", interpret that as level=0 (All Cons)
+  if (arg.length === 1) {
+    level = 0
+    res.embed = constellationsEmbed(id, namespace, level, lang)
+  }
+  if (value === arg) {
+    menu.setDefault(true)
+  }

- if (level < 1 || level > 6) throw 'Invalid constellation.'
+ if (level < 0 || level > 6) throw 'Invalid constellation.'

Also applies to: 317-328

Copy link
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: 0

🧹 Nitpick comments (2)
apps/somnia/src/commands/archive.ts (2)

202-204: Error messages could use more context... stretches

The error messages are a bit too terse. Consider adding more context to help users understand what went wrong.

Here's a suggestion:

-      throw 'Invalid character name'
+      throw `Invalid character name: "${id}". Please use a valid character name.`
-      throw 'Invalid weapon name'
+      throw `Invalid weapon name: "${id}". Please use a valid weapon name.`
-      throw 'Invalid artifact name'
+      throw `Invalid artifact name: "${id}". Please use a valid artifact set name.`

Also applies to: 209-210, 215-216


95-104: Should we remove this commented code? yawns again

If we're not planning to use this language selection code soon, we should remove it. Git history will remember it if we need it later.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9a51bbf and cd933cb.

📒 Files selected for processing (1)
  • apps/somnia/src/commands/archive.ts (6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: call-build / build
  • GitHub Check: lint
🔇 Additional comments (3)
apps/somnia/src/commands/archive.ts (3)

117-119: Nice enhancement to the translate function! sips coffee

The addition of the options parameter allows for more flexible translations. Just what we needed for those talent scalings!

Also applies to: 123-123


140-146: Text cleaning improvements look solid! rubs eyes

Good catch on handling those pesky newlines in italic tags. The whitespace trimming is a nice touch too.


20-20:

❓ Verification inconclusive

Type changes look good! yawns

The transition from CharacterKey to CharacterSheetKey aligns with the PR objectives. Just make sure all consumers of these types are updated accordingly.

Let me check for any missed references:

Also applies to: 23-23


🏁 Script executed:

#!/bin/bash
# Search for any remaining CharacterKey references
rg "CharacterKey" --type ts

Length of output: 65689


Update Verified: Transition from "CharacterKey" to "CharacterSheetKey" in archive.ts is Correct

The changes in apps/somnia/src/commands/archive.ts look solid. You've correctly shifted from using the old allCharacterKeys to allCharacterSheetKeys as part of the character archiving update. Just a heads-up: our grep sweep shows that CharacterKey is still used in many parts of the codebase. If this change is meant to be scoped to the archive functionality only, then it’s all good. Otherwise, ensure that all consumers are updated in a coordinated, incremental migration plan.

Keep up the good work (though I might be running on caffeine at this point)!

@frzyc frzyc added the somnia Discord bot label Feb 23, 2025
@frzyc frzyc changed the title add talent scalings to archive char command Somnia Bot: add talent scalings to archive char command Feb 23, 2025
@frzyc frzyc requested a review from nguyentvan7 February 23, 2025 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
somnia Discord bot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants