Refactor Telegram bot configuration and deep link handling
- Removed the `BotUsername` property from `TelegramOptions` and updated the `.env.example` to reflect this change, as the bot's username is now dynamically retrieved via the Bot API. - Introduced `ITelegramBotInfo` to cache the bot's username, improving the handling of deep links in `TelegramEndpoints`. - Updated API documentation to clarify that the deep link is now dependent on the bot's token and its availability through the Bot API, enhancing clarity for developers.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
namespace PnvPanel.Application.Common.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Метаданные самого бота (не пользователя). Реализация — в Api (нужен ITelegramBotClient),
|
||||
/// аналогично ITelegramNotifier.
|
||||
/// </summary>
|
||||
public interface ITelegramBotInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Username бота для диплинков (https://t.me/{username}?start=...), получен через Bot API
|
||||
/// (getMe), не из ручной конфигурации — так деплинк не сломается из-за опечатки/пробела в env.
|
||||
/// Null, если BotToken не задан или Telegram недоступен.
|
||||
/// </summary>
|
||||
Task<string?> GetUsernameAsync(CancellationToken cancellationToken);
|
||||
}
|
||||
Reference in New Issue
Block a user