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

bug: If a file named "ヘルプ.ts" is added to the "commands" folder, the bot fails to start. #460

Open
1 task done
c7e715d1b04b17683718fb1e8944cc28 opened this issue Jan 19, 2025 · 6 comments
Assignees

Comments

@c7e715d1b04b17683718fb1e8944cc28

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

Although the exact cause could not be identified, when a file named "ヘルプ.ts" is added to the "commands" folder, the bot completely stops at "await client.login();", and no logs are displayed.

Steps To Reproduce

  1. npx sapphire new
  2. cd my-sapphire-bot
  3. npm run generate slashcommand ヘルプ
  4. npm run watch:start

Expected behavior

Bot starts normally.

Screenshots

No response

Additional context

No response

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (24) x64 Intel(R) Core(TM) i7-14650HX
    Memory: 640.49 MB / 15.71 GB
  Binaries:
    Node: 22.11.0 - C:\Program Files\nodejs\node.EXE
    npm: 11.0.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.15.0 - ~\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Edge: Chromium (131.0.2903.70)
@favna
Copy link
Member

favna commented Jan 19, 2025

I'll be honest, this is more than likely because of the non latin alphabet characters and I don't think there is much we can do about this. I recommend using latin alphabet characters for your file names. That said, I suppose some debugging could be done but I wouldn't expect much out of it.

@kyranet
Copy link
Member

kyranet commented Jan 20, 2025

I’ll check this later and evaluate if it’s a /pieces issue, a /framework issue, or I CNR and need to see a minimum reproducible sample.

@kyranet kyranet self-assigned this Jan 20, 2025
@c7e715d1b04b17683718fb1e8944cc28
Copy link
Author

I'll be honest, this is more than likely because of the non latin alphabet characters and I don't think there is much we can do about this. I recommend using latin alphabet characters for your file names. That said, I suppose some debugging could be done but I wouldn't expect much out of it.

You certainly have a point.
However, since the file name is reflected in the command name, I thought it would be easier to understand than changing the command name in the code.

@c7e715d1b04b17683718fb1e8944cc28
Copy link
Author

I’ll check this later and evaluate if it’s a /pieces issue, a /framework issue, or I CNR and need to see a minimum reproducible sample.

Thank you very much!
After a little investigation, the “Kanji” only command works fine. But commands that include “katakana” do not work!

@kyranet kyranet transferred this issue from sapphiredev/framework Jan 20, 2025
@kyranet
Copy link
Member

kyranet commented Jan 20, 2025

Update: This issue cannot be reproduced outside of Japanese Windows, which uses CP932 (Shift-JIS) as default encoding rather than UTF-8/16. Node.js however, reads it correctly as UTF-16 as shown by the debugger. Pending to see whether or not Node.js translates that UTF-16 back to CP932 when reading the file.

Repro repository: https://github.com/c7e715d1b04b17683718fb1e8944cc28/my-sapphire-bot

@kyranet
Copy link
Member

kyranet commented Jan 20, 2025

There seems to be an issue with Node.js v22.13.0 and v23.6.0, both can read file names correctly from a Shift-JIS encoded filesystem, but neither can read files using the same names.

Re-encoding Shift-JIS as UTF8 and vice-versa does not seem fix the issue either.

The loader works as intended when using Deno, pointing this issue to a bug in Node.js, see similar issue:

Will investigate a little deeper, then open an issue in Node.js's tracker.

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

No branches or pull requests

3 participants