TelegramAsDatabase 2.1.0
See the version list below for details.
dotnet add package TelegramAsDatabase --version 2.1.0
NuGet\Install-Package TelegramAsDatabase -Version 2.1.0
<PackageReference Include="TelegramAsDatabase" Version="2.1.0" />
<PackageVersion Include="TelegramAsDatabase" Version="2.1.0" />
<PackageReference Include="TelegramAsDatabase" />
paket add TelegramAsDatabase --version 2.1.0
#r "nuget: TelegramAsDatabase, 2.1.0"
#:package TelegramAsDatabase@2.1.0
#addin nuget:?package=TelegramAsDatabase&version=2.1.0
#tool nuget:?package=TelegramAsDatabase&version=2.1.0
TelegramAsDatabase
The official repository for telegram as database
Now telegram as database (TDB) is availabe on nuget.org: click here
Getting start
Create a bot using bot father in telegram (Important: Dont Change the bot description at all)
Create a channel as a database source in telegram
Now add your bot that created in the first step to the channel as an administrator and give all premissions to it.
Goto your appsettings and add TDB config to it.:
- The api key is key that you get from BotFather in the first step
- The Channel Id is the id of the channel you can get it by forwarding a message of the channel to @userinfobot bot.
"TDBConfig": { "ApiKey": "7753344678:AAFf4MIQSShxa4djp172DjhDe2_jqRsyOeU", "ChannelId": "-1002378130994" }
Now Add Tdb to your service container:
var configurations = builder.Configuration; builder.Services.AddTDB(configurations);
Done! now you can use the telegram free database
How to use
The example code of using the TDB:
public class MyCustomService
{
private ITDB _tdbService;
public MyCustomService(ITDB tdb)
{
_tdbService = tdb;
}
public async Task MyCustomMethod(CancellationToken cancellationToken)
{
// [--------- GetAllKeysAsync ---------]
var allKeys = await _tdbService.GetAllKeysAsync(cancellationToken);
// [------------ SaveAsync ------------]
var saveResult = await _tdbService.SaveAsync(new TDBData<MyTestModel>()
{
Key = "item-key",
Value = new MyTestModel()
{
Name = "FirstTest",
Description = "FirstDescription",
Type = "FuncTest"
}
}, cancellationToken);
// [--------- UpdateAsync ---------]
var updateResult = await _tdbService.UpdateAsync("item-key", new TDBData<MyTestModel>()
{
Key = "item-key",
Value = new MyTestModel()
{
Name = "FirstTest2",
Description = "FirstDescription2",
Type = "FuncTest2"
}
}, cancellationToken);
// [--------- DeleteAsync ---------]
var deleteResult = await _tdbService.DeleteAsync("item-key", cancellationToken);
}
}
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. 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. |
-
net8.0
- FluentResults (>= 3.16.0)
- MemoryPack (>= 1.21.3)
- Microsoft.Extensions.Logging.Console (>= 8.0.0)
- Newtonsoft.Json (>= 13.0.3)
- Telegram.Bot (>= 22.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial Release