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

bot/modules/nostr: convert to TS #627

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

webwarrior-ws
Copy link
Contributor

Convert bot/modules/nostr to TypeScript.
Specified "lib" property in tsconfig.json because otherwise TypeScript compiler complains about usage of Promise.any in bot/modules/nostr/index.ts:

Property 'any' does not exist on type 'PromiseConstructor'. Do you need to change your target library? Try changing the lib compiler option to 'es2021' or later.

Convert bot/modules/nostr to TypeScript.
Specified "lib" property in tsconfig.json because otherwise
TypeScript compiler complains about usage of `Promise.any`
in bot/modules/nostr/index.ts:
```
Property 'any' does not exist on type 'PromiseConstructor'. Do you need to change your target library? Try changing the lib compiler option to 'es2021' or later.
```
Copy link
Member

@Catrya Catrya left a comment

Choose a reason for hiding this comment

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

Hi @webwarrior-ws when I type /nostr have an Error
Captura desde 2025-01-22 18-19-13

and when type /npub with a correct npub this the bot says:
⚠️ ERROR Not a valid NIP-19 (https://github.com/nostr-protocol/nips/blob/master/19.md) npub. Please check your input.

Decode nostr secret key from environment variable using hex
encoding. Also replace requires with imports.
@webwarrior-ws
Copy link
Contributor Author

@Catrya take a look, I added a commit that should fix the error. Assuming NOSTR_SK env. var is hex-encoded. If not, tell me what format it is in.

bot/modules/nostr/index.ts Outdated Show resolved Hide resolved
bot/modules/nostr/index.ts Outdated Show resolved Hide resolved
@Catrya
Copy link
Member

Catrya commented Jan 24, 2025

Hi, @webwarrior-ws it keep getting the same 2 errors: with /nostr and /setnpub

Anyway, what do you think @grunch about removing the /setnpub part because in the end I think that was no longer working anyway (I'm not referring to the current error of not accepting npub, but to what it was intended to do, which was to notify the user through nostr if someone took their order, and I can't find the 20100 events that it should publish in the relays) Or maybe leave it and then evaluate whether to keep that feature and fix it?

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.

3 participants