Skip to content

Add countdown bot reference example#516

Merged
baxen merged 1 commit into
mainfrom
baxen/reference-bot-examples
May 8, 2026
Merged

Add countdown bot reference example#516
baxen merged 1 commit into
mainfrom
baxen/reference-bot-examples

Conversation

@baxen

@baxen baxen commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add an examples directory entry for reference implementations
  • add a tiny non-AI countdown bot example that authenticates over NIP-42 and listens to one Sprout channel
  • support standalone and owner-attested auth, kind:0 bot profile publishing, best-effort channel bot membership, bang commands, and @mention commands

Test plan

  • . ./bin/activate-hermit && cargo fmt -p countdown-bot -- --check
  • . ./bin/activate-hermit && cargo check -p countdown-bot
  • . ./bin/activate-hermit && cargo test -p countdown-bot

Note: pre-commit/pre-push full hooks were partially blocked locally by missing desktop/web node_modules and missing dart/flutter CLIs; Rust/Tauri checks that could run passed, and this PR is limited to Rust example/docs.

@baxen baxen requested a review from wesbillman as a code owner May 8, 2026 21:50

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c0c1ae463b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +236 to +237
if event.pubkey == config.bot_keys.public_key() || event.created_at < started_at {
return Ok(());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid filtering post-start events by created_at

The startup guard event.created_at < started_at drops valid commands that arrive after subscription when the sender's clock is behind the bot's clock. In Sprout, relay ingest allows a sizeable timestamp drift (±15 minutes), so a newly posted !countdown/!fib from a skewed client can be accepted by the relay but ignored here forever as “old.” This makes the bot silently miss real-time commands; use an EOSE boundary or a since filter instead of comparing untrusted client timestamps to local startup time.

Useful? React with 👍 / 👎.

@baxen baxen merged commit c6da3a7 into main May 8, 2026
15 checks passed
@baxen baxen deleted the baxen/reference-bot-examples branch May 8, 2026 22:39
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.

1 participant