Added types for future State keepers overhaul

This commit is contained in:
2025-08-13 01:11:42 +04:00
parent cbfb1d4e8d
commit 68e171f082
14 changed files with 52 additions and 11 deletions
@@ -1,7 +1,7 @@
using Telegram.Bot.Types;
using Telegrator.Filters.Components;
using Telegrator.Handlers.Components;
using Telegrator.StateKeeping.Components;
using Telegrator.StateKeeping.Abstracts;
namespace Telegrator.Attributes.Components
{
@@ -2,6 +2,7 @@
using Telegrator.Annotations.StateKeeping;
using Telegrator.Attributes.Components;
using Telegrator.Filters.Components;
using Telegrator.StateKeeping.Abstracts;
using Telegrator.StateKeeping.Components;
namespace Telegrator.Attributes
@@ -5,6 +5,7 @@ using Telegrator.Filters.Components;
using Telegrator.Handlers.Components;
using Telegrator.MadiatorCore;
using Telegrator.MadiatorCore.Descriptors;
using Telegrator.StateKeeping.Abstracts;
using Telegrator.StateKeeping.Components;
namespace Telegrator.Handlers.Building.Components
@@ -1,6 +1,7 @@
using Telegram.Bot.Types;
using Telegrator.Annotations.StateKeeping;
using Telegrator.Filters.Components;
using Telegrator.StateKeeping.Abstracts;
using Telegrator.StateKeeping.Components;
namespace Telegrator.Handlers.Building.Components
@@ -2,6 +2,7 @@
using Telegrator.Annotations.StateKeeping;
using Telegrator.Filters;
using Telegrator.Filters.Components;
using Telegrator.StateKeeping.Abstracts;
using Telegrator.StateKeeping.Components;
namespace Telegrator.Handlers.Building.Components
@@ -1,6 +1,4 @@
using Telegrator.StateKeeping.Components;
namespace Telegrator.StateKeeping
namespace Telegrator.StateKeeping.Abstracts
{
/// <summary>
/// Abstract base class for state keepers that manage state transitions using an array of predefined states.
@@ -1,6 +1,7 @@
using Telegram.Bot.Types;
using Telegrator.StateKeeping.Components;
namespace Telegrator.StateKeeping.Components
namespace Telegrator.StateKeeping.Abstracts
{
/// <summary>
/// Base class for managing state associated with updates and keys.
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Telegrator.StateKeeping.Abstracts
{
/*
public class UpdateBasedStateKeeperBase
{
}
*/
}
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Telegrator.StateKeeping.Components
{
/*
public interface IStateKeepingFacility
{
public void SetState(object key, object value);
public object GetState(object key);
}
*/
}
+1 -1
View File
@@ -1,6 +1,6 @@
using Telegrator.Annotations.StateKeeping;
using Telegrator.Handlers.Components;
using Telegrator.StateKeeping;
using Telegrator.StateKeeping.Abstracts;
namespace Telegrator.StateKeeping
{
@@ -0,0 +1,8 @@
namespace Telegrator.StateKeeping.Facilities
{
/*
public class JsonStateKeepingFacility : IStateKeepingFacility
{
}
*/
}
@@ -1,6 +1,6 @@
using Telegrator.Annotations.StateKeeping;
using Telegrator.Handlers.Components;
using Telegrator.StateKeeping.Components;
using Telegrator.StateKeeping.Abstracts;
namespace Telegrator.StateKeeping
{
+6 -4
View File
@@ -1,13 +1,13 @@
using Telegrator.Annotations.StateKeeping;
using Telegrator.Handlers.Components;
using Telegrator.StateKeeping.Components;
using Telegrator.StateKeeping.Abstracts;
namespace Telegrator.StateKeeping
{
/// <summary>
/// State keeper that manages string-based states for chat sessions.
/// </summary>
public class StringStateKeeper() : StateKeeperBase<string, string>()
public class StringStateKeeper() : StateKeeperBase<long, string>()
{
/// <summary>
/// Gets the default state value, which is an empty string.
@@ -15,13 +15,13 @@ namespace Telegrator.StateKeeping
public override string DefaultState => string.Empty;
/// <inheritdoc/>
protected override string MoveBackward(string currentState, string currentKey)
protected override string MoveBackward(string currentState, long currentKey)
{
throw new NotImplementedException();
}
/// <inheritdoc/>
protected override string MoveForward(string currentState, string currentKey)
protected override string MoveForward(string currentState, long currentKey)
{
throw new NotImplementedException();
}
@@ -63,8 +63,10 @@ namespace Telegrator.StateKeeping
public static void SetStringState(this IHandlerContainer container, string? newState)
=> container.StringStateKeeper().SetState(container.HandlingUpdate, newState ?? StringStateAttribute.DefaultState);
/*
public static string GetStringState(this IHandlerContainer container, string key)
=> container.StringStateKeeper().GetState()
*/
/*
/// <summary>
+1
View File
@@ -18,6 +18,7 @@ using Telegrator.MadiatorCore;
using Telegrator.MadiatorCore.Descriptors;
using Telegrator.Providers;
using Telegrator.StateKeeping;
using Telegrator.StateKeeping.Abstracts;
using Telegrator.StateKeeping.Components;
namespace Telegrator