File tree Expand file tree Collapse file tree 2 files changed +17
-15
lines changed
Botticelli.Framework/Commands/Processors Expand file tree Collapse file tree 2 files changed +17
-15
lines changed Original file line number Diff line number Diff line change 1+ using System . Collections . Concurrent ;
2+
3+ namespace Botticelli . Framework . Commands . Processors ;
4+
5+ public static class ChainStateKeeper
6+ {
7+ private static readonly ConcurrentDictionary < string , bool > IsChainOpened = new ( ) ;
8+
9+ public static bool GetState ( string chatId ) => IsChainOpened . TryGetValue ( chatId , out var isChainOpened ) && isChainOpened ;
10+
11+ public static void SetState ( string chatId , bool isChainOpened ) => IsChainOpened [ chatId ] = isChainOpened ;
12+
13+ public static void SetState ( IEnumerable < string > chatIds , bool isChainOpened )
14+ {
15+ foreach ( var chatId in chatIds ) SetState ( chatId , isChainOpened ) ;
16+ }
17+ }
Original file line number Diff line number Diff line change 1- using System . Collections . Concurrent ;
21using Botticelli . Client . Analytics ;
32using Botticelli . Framework . Commands . Validators ;
43using Botticelli . Interfaces ;
87
98namespace Botticelli . Framework . Commands . Processors ;
109
11- public static class ChainStateKeeper
12- {
13- private static readonly ConcurrentDictionary < string , bool > IsChainOpened = new ( ) ;
14-
15- public static bool GetState ( string chatId ) => IsChainOpened . TryGetValue ( chatId , out var isChainOpened ) && isChainOpened ;
16-
17- public static void SetState ( string chatId , bool isChainOpened ) => IsChainOpened [ chatId ] = isChainOpened ;
18-
19- public static void SetState ( IEnumerable < string > chatIds , bool isChainOpened )
20- {
21- foreach ( var chatId in chatIds ) SetState ( chatId , isChainOpened ) ;
22- }
23- }
24-
2510/// <summary>
2611/// A command with waiting for a response
2712/// </summary>
You can’t perform that action at this time.
0 commit comments