Skip to content

MrAliSalehi/SharpGram

Repository files navigation

badge

SharpGram

Telegram Mtproto Library written in C#


this is an opinion-based(around code design not mtproto itself) implementation mainly focusing on the features alongside with code best practices.

it should not bring extra complexity to the projects and allow developers to focus on business logic rather than dealing with implementation details around mtproto

this library does not focus on being the backend for GUI clients and creating apps for normal users; the main focus of this library is creating automated tasks and user bots.


Use

this project is on nuget, BUT it's not stable and ready to be used in the real world, yet. and there are no documentations yet.

Todo list

there are a lot of //TODO comments everywhere in project. I'll mention the important ones here.

  • writing documentation, preferably a static website.
  • update handling.
  • Proper logging (allow users to choose between log levels and the ability to have any log implementation they want, e.x serilog, nlog...etc.).
  • writing more unit tests for the project.
  • Proper session implementation. (currently its just plain normal json... which is not very awesome). it can be more flexible and generic, so it can be stored anywhere with ease. and maybe it can automatically sync its state without needing the user to manually Save() it.
  • handling more errors and making the library more resilient.
  • custom reconnection and retry policies (allow uses to check their own condition to decide if they want to retry/reconnect on different cases).
  • more abstractions for the Client in general.
  • moving away from OOP style to more FP approaches in different parts of the code, something like this.
  • refactoring the client so that it can be flexible on Connection Type (tcp,udp...etc.) and Transport layers(currently it can change between transport layers but that socket type is hard coded, even tho they are both defined as generics).
  • reviewing and optimizing encryption and serialization/deserialization process.
  • multi account management.
  • writing a better generator. (at the beginning it was written with source-generator but due to its limitations around File and HttpClient it was refactored into normal console app.) currently the schema has to be updated manually and be deployed with the core library, which isn't very optimal.
  • add build and test actions on GitHub.
  • enabling AOT (there shouldn't be much todo, it just needs a review and enabling it in the config).

Credits

writing this project was a great (and hard) journey for me, but it could not be achieved alone.

special thanks to:

I've mentioned/referenced every piece of code that I've copied from any source in the code comments, I might have forgotten some of them which I apologize for it; please let me know if you saw any code without credits.

Contribution

dear contributor, before opening a PR please discuss your ideas either in the discussions or telegram.

About

Telegram mtproto Client for dotnet

Resources

License

Stars

Watchers

Forks

Languages