SharpGram 1.0.2

dotnet add package SharpGram --version 1.0.2                
NuGet\Install-Package SharpGram -Version 1.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SharpGram" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SharpGram --version 1.0.2                
#r "nuget: SharpGram, 1.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 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.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.2 79 9/30/2024
1.0.1 69 8/1/2024