Skip to content

tg accounts switch is undone by activeAccount in config.json #61

Closed

Description

@neoromantic

tg accounts switch --id 2 sets is_active in data.db, but on every start (except tg config) the CLI applies activeAccount from config.json again (syncActiveAccountFromConfig in src/config/index.ts). So with "activeAccount": 1 in the config, the switch lasts for that command only: the next command switches back to account 1.

Since #17 each account has its own cache, so this decides which account's chats, messages and tg sql rows a command without --account returns.

Example: accounts 1 (+15550000001) and 2 (+15550000002), tg config set activeAccount 1, then tg accounts switch --id 2; tg chats list still reads account 1.

Fix options: tg accounts switch also writes activeAccount when the config has one, or the config value is applied only when it changes. Done when an e2e test shows that after tg accounts switch --id 2 the next tg chats list reads account 2 with and without activeAccount in the config, and docs/configuration.md says which wins.

Activity

  1. added 2 commits that reference this issue on Oct 22, 2026
    700434e
    2b4a0cb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions