ptgc
MTProto client for Dart

Contributing

Bug reports, feature requests, and pull requests are all welcome on GitHub.

Reporting a bug

Include:

  • The ptgc version (from your pubspec.lock).
  • A minimal reproduction — ideally adapted from one of the Examples.
  • The full exception, including RpcException.code/description if that’s what you hit.

Don’t include your API_HASH, session file contents, or phone number in a public issue.

Working on the code

git clone https://github.com/psdkjoon/ptgc.git
cd ptgc
dart pub get
dart test

Most of the raw MTProto layer (lib/src/tl.dart, lib/src/mtp.dart) is generated from Telegram’s schema and shouldn’t be hand-edited — changes there belong in the generator, not the output. The typed surface under lib/src/ (client.dart, auth.dart, chats.dart, members.dart, contacts.dart, messages.dart, rights.dart, models.dart, session.dart, peer_cache.dart, updates.dart, exceptions.dart) is regular hand-written Dart.

Style

  • Every public member gets a /// doc comment — this site’s API Reference is generated from them.
  • Prefer adding a typed wrapper on the appropriate namespace over telling people to reach for client.invoke — the raw escape hatch is there for the long tail, not the common case.
  • New examples go in example/, numbered after the last one, following the header-comment format the existing files use (title, description, HOW TO RUN).

Before opening a PR

dart format --set-exit-if-changed .
dart analyze
dart test