Skip to content

feat: support --account and explicit credentials for get-context-token#20

Merged
lewiszlw merged 2 commits intomasterfrom
feat/get-context-token-auth
Apr 24, 2026
Merged

feat: support --account and explicit credentials for get-context-token#20
lewiszlw merged 2 commits intomasterfrom
feat/get-context-token-auth

Conversation

@lewiszlw
Copy link
Copy Markdown
Member

This PR modifies the get-context-token subcommand to support two authentication modes, aligned with the existing send subcommand:

  1. Saved Account Mode: --account <index>
  2. Explicit Credentials Mode: --bot-token <token> --user-id <user_id> [--route-tag <route_tag>]

When no authentication parameters are provided, the command falls back to the first saved account (preserving backward compatibility).

Changes

  • src/cli.rs: Expanded GetContextTokenArgs to include account, user_id, bot_token, and route_tag fields.
  • src/commands/send.rs: Made SendTarget and resolve_send_target public so they can be reused.
  • src/commands/get_context_token.rs: Reused SendTarget and resolve_send_target from send.rs, removing the previously duplicated Target enum and resolve_target function.
  • src/main.rs: Updated the GetContextToken command dispatch to pass the new arguments.

Validation

  • cargo build — success
  • cargo test — 15 passed; 0 failed
  • cargo clippy -- -D warnings — success (no warnings)

@lewiszlw lewiszlw merged commit 23115a2 into master Apr 24, 2026
3 checks passed
@lewiszlw lewiszlw deleted the feat/get-context-token-auth branch April 24, 2026 03:23
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