diff --git a/src/Telegartor.RedisStateStorage/README.md b/src/Telegartor.RedisStateStorage/README.md index e69de29..ced8d61 100644 --- a/src/Telegartor.RedisStateStorage/README.md +++ b/src/Telegartor.RedisStateStorage/README.md @@ -0,0 +1,57 @@ +# Telegrator.RedisStateStorage + +**Telegrator.RedisStateStorage** is an extension for the Telegrator framework that provides Redis powered IStateStorage implementation. + +--- + +## Requirements +- .NET standart 2.1 or later +- [Telegrator](https://github.com/Rikitav/Telegrator) + +--- + +## Installation + +```shell +dotnet add package Telegrator.RedisStateStorage +``` + +--- + +## Quick Start Example + +**Program.cs:** +```csharp +using Telegrator.Hosting; + +// Creating builder +TelegramBotHostBuilder builder = TelegramBotHost.CreateBuilder(new HostApplicationBuilderSettings() +{ + Args = args, + ApplicationName = "TelegramBotHost example", +}); + +// Registerring handlers +builder.Handlers.CollectHandlersAssemblyWide(); + +// Register your services and +builder.Services.AddService(services => + new RedisStateStorage(ConnectionMultiplexer.Connect("server1:6379, server2:6379"))); + +// Building and running application +TelegramBotHost telegramBot = builder.Build(); +telegramBot.SetBotCommands(); +telegramBot.Run(); +``` + +--- + +## Documentation +- [Telegrator Main Docs](https://github.com/Rikitav/Telegrator) +- [Getting Started Guide](https://github.com/Rikitav/Telegrator/wiki/Getting-started) +- [Annotation Overview](https://github.com/Rikitav/Telegrator/wiki/Annotation-overview) + +--- + +## License +GPLv3 \ No newline at end of file diff --git a/src/Telegartor.RedisStateStorage/States/RedisStateStorage.cs b/src/Telegartor.RedisStateStorage/States/RedisStateStorage.cs index ce4dac4..01f89c2 100644 --- a/src/Telegartor.RedisStateStorage/States/RedisStateStorage.cs +++ b/src/Telegartor.RedisStateStorage/States/RedisStateStorage.cs @@ -16,7 +16,7 @@ public class RedisStateStorage(IConnectionMultiplexer redis) : IStateStorage } /// - public async Task GetAsync(string key, CancellationToken cancellationToken) where T : default + public async Task GetAsync(string key, CancellationToken cancellationToken) { RedisValue json = await _db.StringGetAsync(key); string? jsonStr = json;