Skip to content

tg send takes an unknown positive ID as a basic group #47

Closed

Description

@neoromantic

Found while fixing #18. A positive number that the cache doesn't know as a user, a private chat or a 0.2.0 group or channel ID becomes basic group N in resolveUncachedId (src/commands/send/peer-resolver.ts), unless it has 10 or more digits (then it is a phone number). Every tg command now prints basic groups as -N, and a positive marked ID is a user, so tg send --to 4242 with an uncached user ID or a typo sends to basic group 4242 or fails with PEER_ID_INVALID.

Fix: take an uncached positive number as a user ID (with access hash 0, as for a known user without one), or fail with INVALID_ARGS and suggest -N for a basic group. Update docs/api-design.md and docs/cli-commands.md.

Done when unit tests show resolvePeer('4242') with an empty cache doesn't build inputPeerChat, and -4242 still does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions