SharpGram 1.0.2
dotnet add package SharpGram --version 1.0.2
NuGet\Install-Package SharpGram -Version 1.0.2
<PackageReference Include="SharpGram" Version="1.0.2" />
paket add SharpGram --version 1.0.2
#r "nuget: SharpGram, 1.0.2"
// Install SharpGram as a Cake Addin #addin nuget:?package=SharpGram&version=1.0.2 // Install SharpGram as a Cake Tool #tool nuget:?package=SharpGram&version=1.0.2
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
andHttpClient
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:
- lonami for his helps and inspirations with grammers and Telethon.
- Wizou for his guidance and inspirations with WTC.
- mIwr for his Aes-Ige implementation that is used in this project.
-
I did not use his nuget package directly due to the changes that was needed to his source code.
-
- davide for his server-side implementation of mtproto, piltover.
- alina for her great inspirations with mtcute.
- Roj for his great project MTKruto.
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.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- SharpGram.Core (>= 1.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.