Добавлены новые методы отправки сообщений
This commit is contained in:
@@ -1,6 +1,28 @@
|
||||
namespace BotPages.Core.Abstractions;
|
||||
using BotPages.Core.Context;
|
||||
|
||||
namespace BotPages.Core.Abstractions;
|
||||
|
||||
/// <summary>
|
||||
/// Ключ для идентификации пользовательской сессии.
|
||||
/// </summary>
|
||||
public readonly record struct CompositeSessionKey(string MessengerType, string ChatId, string? UserId);
|
||||
public readonly record struct CompositeSessionKey(string AdapterId, string ChatId, string? UserId)
|
||||
{
|
||||
/// <summary>
|
||||
/// Создает ключ сессии из UpdateContext.
|
||||
/// </summary>
|
||||
public static CompositeSessionKey FromUpdate(UpdateContext update)
|
||||
{
|
||||
return new CompositeSessionKey(
|
||||
update.AdapterId,
|
||||
update.Chat.Id,
|
||||
update.User.Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получить ключ для определенного адаптера.
|
||||
/// </summary>
|
||||
public CompositeSessionKey ForAdapter(string adapterId)
|
||||
{
|
||||
return new CompositeSessionKey(adapterId, ChatId, UserId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user