TGSimpleLib 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TGSimpleLib --version 1.1.0
                    
NuGet\Install-Package TGSimpleLib -Version 1.1.0
                    
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="TGSimpleLib" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TGSimpleLib" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="TGSimpleLib" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TGSimpleLib --version 1.1.0
                    
#r "nuget: TGSimpleLib, 1.1.0"
                    
#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.
#:package TGSimpleLib@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TGSimpleLib&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=TGSimpleLib&version=1.1.0
                    
Install as a Cake Tool

TGSimpleLib 🤖

GitHub

English | Русский


English

TGSimpleLib is a lightweight C# wrapper for Telegram bots. It's designed for developers who need to send notifications, files, and get instant feedback without setting up complex bot architectures.

What's new in v1.1.0:

  • File Uploads: Send logs, documents, or memory streams directly to admins.
  • Error Reporting: Beautifully formatted exception reports with stack traces.
  • Full Localization: All built-in buttons and messages are now in English for global compatibility.

Usage:

// Initialize: Token, Timeout (sec), and Admin IDs
var bot = new SimpleTG("YOUR_TOKEN", 30, 12345678);

// 1. Simple notification
await bot.NotifyAsync("🚀 System started!");

// 2. File upload from disk
await bot.SendFileAsync("logs/app.log", "Today's server log");

// 3. File upload from Memory (Stream) without disk access
byte[] logBytes = System.Text.Encoding.UTF8.GetBytes("This is an in-memory report");
using (var ms = new System.IO.MemoryStream(logBytes))
{
    await bot.SendFileAsync(ms, "report.txt", "Dynamic report");
}

// 4. Exception reporting (formatted report)
try {
    // some risky code
} catch (Exception ex) {
    await bot.ReportErrorAsync("Database sync failed", ex);
}

// 5. Interactive questions (Yes/No or Custom)
bool confirm = await bot.AskBoolAsync("Deploy to production?");
string mode = await bot.AskChoiceAsync("Select mode:", new[] { "Eco", "Turbo" });

// 6. Wait for text input (via ForceReply)
string comment = await bot.AskStringAsync("Enter your comment:");

Русский

TGSimpleLib — это максимально простая библиотека-обертка для Telegram ботов на C#. Она создана для тех, кому нужно быстро добавить систему уведомлений, отправку файлов и опросов в свои приложения без написания сложной архитектуры.

Что нового в v1.1.0:

  • Отправка файлов: Отправляйте логи или документы прямо с диска или из оперативной памяти (Stream).
  • Отчеты об ошибках: Красиво отформатированные отчеты об исключениях (Exception) со стек-трейсом.
  • Локализация: Все встроенные кнопки и системные сообщения переведены на английский для универсальности.

Примеры использования:

// Инициализация: Токен, Таймаут (сек) и ID админов
var bot = new SimpleTG("ВАШ_ТОКЕН", 30, 12345678);

// 1. Простое уведомление
await bot.NotifyAsync("🚀 Система запущена!");

// 2. Отправка файлов с диска
await bot.SendFileAsync("logs/app.log", "Лог сервера");

// 3. Отправка данных из памяти (Stream) без сохранения файла на диск
byte[] logBytes = System.Text.Encoding.UTF8.GetBytes("Это отчет из памяти");
using (var ms = new System.IO.MemoryStream(logBytes))
{
    await bot.SendFileAsync(ms, "report.txt", "Динамический отчет");
}

// 4. Отчет об ошибке (красивый формат с деталями)
try {
    // ваш код
} catch (Exception ex) {
    await bot.ReportErrorAsync("Ошибка в модуле БД", ex);
}

// 5. Вопросы (Да/Нет или свои варианты)
bool confirm = await bot.AskBoolAsync("Выполнить деплой?");
string mode = await bot.AskChoiceAsync("Выберите режим:", new[] { "Эконом", "Турбо" });

// 6. Ожидание ввода текста
string comment = await bot.AskStringAsync("Введите ваш комментарий:");
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.2.0 121 3/6/2026
1.1.0 103 3/5/2026
1.0.0 110 3/3/2026