Added types for future State keepers overhaul
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
using Telegram.Bot.Types;
|
using Telegram.Bot.Types;
|
||||||
using Telegrator.Filters.Components;
|
using Telegrator.Filters.Components;
|
||||||
using Telegrator.Handlers.Components;
|
using Telegrator.Handlers.Components;
|
||||||
using Telegrator.StateKeeping.Components;
|
using Telegrator.StateKeeping.Abstracts;
|
||||||
|
|
||||||
namespace Telegrator.Attributes.Components
|
namespace Telegrator.Attributes.Components
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Telegrator.Annotations.StateKeeping;
|
using Telegrator.Annotations.StateKeeping;
|
||||||
using Telegrator.Attributes.Components;
|
using Telegrator.Attributes.Components;
|
||||||
using Telegrator.Filters.Components;
|
using Telegrator.Filters.Components;
|
||||||
|
using Telegrator.StateKeeping.Abstracts;
|
||||||
using Telegrator.StateKeeping.Components;
|
using Telegrator.StateKeeping.Components;
|
||||||
|
|
||||||
namespace Telegrator.Attributes
|
namespace Telegrator.Attributes
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Telegrator.Filters.Components;
|
|||||||
using Telegrator.Handlers.Components;
|
using Telegrator.Handlers.Components;
|
||||||
using Telegrator.MadiatorCore;
|
using Telegrator.MadiatorCore;
|
||||||
using Telegrator.MadiatorCore.Descriptors;
|
using Telegrator.MadiatorCore.Descriptors;
|
||||||
|
using Telegrator.StateKeeping.Abstracts;
|
||||||
using Telegrator.StateKeeping.Components;
|
using Telegrator.StateKeeping.Components;
|
||||||
|
|
||||||
namespace Telegrator.Handlers.Building.Components
|
namespace Telegrator.Handlers.Building.Components
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Telegram.Bot.Types;
|
using Telegram.Bot.Types;
|
||||||
using Telegrator.Annotations.StateKeeping;
|
using Telegrator.Annotations.StateKeeping;
|
||||||
using Telegrator.Filters.Components;
|
using Telegrator.Filters.Components;
|
||||||
|
using Telegrator.StateKeeping.Abstracts;
|
||||||
using Telegrator.StateKeeping.Components;
|
using Telegrator.StateKeeping.Components;
|
||||||
|
|
||||||
namespace Telegrator.Handlers.Building.Components
|
namespace Telegrator.Handlers.Building.Components
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Telegrator.Annotations.StateKeeping;
|
using Telegrator.Annotations.StateKeeping;
|
||||||
using Telegrator.Filters;
|
using Telegrator.Filters;
|
||||||
using Telegrator.Filters.Components;
|
using Telegrator.Filters.Components;
|
||||||
|
using Telegrator.StateKeeping.Abstracts;
|
||||||
using Telegrator.StateKeeping.Components;
|
using Telegrator.StateKeeping.Components;
|
||||||
|
|
||||||
namespace Telegrator.Handlers.Building.Components
|
namespace Telegrator.Handlers.Building.Components
|
||||||
|
|||||||
+1
-3
@@ -1,6 +1,4 @@
|
|||||||
using Telegrator.StateKeeping.Components;
|
namespace Telegrator.StateKeeping.Abstracts
|
||||||
|
|
||||||
namespace Telegrator.StateKeeping
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Abstract base class for state keepers that manage state transitions using an array of predefined states.
|
/// Abstract base class for state keepers that manage state transitions using an array of predefined states.
|
||||||
+2
-1
@@ -1,6 +1,7 @@
|
|||||||
using Telegram.Bot.Types;
|
using Telegram.Bot.Types;
|
||||||
|
using Telegrator.StateKeeping.Components;
|
||||||
|
|
||||||
namespace Telegrator.StateKeeping.Components
|
namespace Telegrator.StateKeeping.Abstracts
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base class for managing state associated with updates and keys.
|
/// 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,6 +1,6 @@
|
|||||||
using Telegrator.Annotations.StateKeeping;
|
using Telegrator.Annotations.StateKeeping;
|
||||||
using Telegrator.Handlers.Components;
|
using Telegrator.Handlers.Components;
|
||||||
using Telegrator.StateKeeping;
|
using Telegrator.StateKeeping.Abstracts;
|
||||||
|
|
||||||
namespace Telegrator.StateKeeping
|
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.Annotations.StateKeeping;
|
||||||
using Telegrator.Handlers.Components;
|
using Telegrator.Handlers.Components;
|
||||||
using Telegrator.StateKeeping.Components;
|
using Telegrator.StateKeeping.Abstracts;
|
||||||
|
|
||||||
namespace Telegrator.StateKeeping
|
namespace Telegrator.StateKeeping
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
using Telegrator.Annotations.StateKeeping;
|
using Telegrator.Annotations.StateKeeping;
|
||||||
using Telegrator.Handlers.Components;
|
using Telegrator.Handlers.Components;
|
||||||
using Telegrator.StateKeeping.Components;
|
using Telegrator.StateKeeping.Abstracts;
|
||||||
|
|
||||||
namespace Telegrator.StateKeeping
|
namespace Telegrator.StateKeeping
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// State keeper that manages string-based states for chat sessions.
|
/// State keeper that manages string-based states for chat sessions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class StringStateKeeper() : StateKeeperBase<string, string>()
|
public class StringStateKeeper() : StateKeeperBase<long, string>()
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the default state value, which is an empty string.
|
/// Gets the default state value, which is an empty string.
|
||||||
@@ -15,13 +15,13 @@ namespace Telegrator.StateKeeping
|
|||||||
public override string DefaultState => string.Empty;
|
public override string DefaultState => string.Empty;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
protected override string MoveBackward(string currentState, string currentKey)
|
protected override string MoveBackward(string currentState, long currentKey)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
protected override string MoveForward(string currentState, string currentKey)
|
protected override string MoveForward(string currentState, long currentKey)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@@ -63,8 +63,10 @@ namespace Telegrator.StateKeeping
|
|||||||
public static void SetStringState(this IHandlerContainer container, string? newState)
|
public static void SetStringState(this IHandlerContainer container, string? newState)
|
||||||
=> container.StringStateKeeper().SetState(container.HandlingUpdate, newState ?? StringStateAttribute.DefaultState);
|
=> container.StringStateKeeper().SetState(container.HandlingUpdate, newState ?? StringStateAttribute.DefaultState);
|
||||||
|
|
||||||
|
/*
|
||||||
public static string GetStringState(this IHandlerContainer container, string key)
|
public static string GetStringState(this IHandlerContainer container, string key)
|
||||||
=> container.StringStateKeeper().GetState()
|
=> container.StringStateKeeper().GetState()
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ using Telegrator.MadiatorCore;
|
|||||||
using Telegrator.MadiatorCore.Descriptors;
|
using Telegrator.MadiatorCore.Descriptors;
|
||||||
using Telegrator.Providers;
|
using Telegrator.Providers;
|
||||||
using Telegrator.StateKeeping;
|
using Telegrator.StateKeeping;
|
||||||
|
using Telegrator.StateKeeping.Abstracts;
|
||||||
using Telegrator.StateKeeping.Components;
|
using Telegrator.StateKeeping.Components;
|
||||||
|
|
||||||
namespace Telegrator
|
namespace Telegrator
|
||||||
|
|||||||
Reference in New Issue
Block a user