27 lines
873 B
C#
27 lines
873 B
C#
using BotPages.Core;
|
|
|
|
namespace BotPages.Telegram;
|
|
|
|
/// <summary>
|
|
/// Расширения для <see cref="BotPagesApp"/>.
|
|
/// </summary>
|
|
public static class BotPagesAppExtension
|
|
{
|
|
/// <summary>
|
|
/// Добавление адаптера для телеграмм в <see cref="BotPages.Core.Abstractions.IMessengerAdapterFactory"/>
|
|
/// </summary>
|
|
/// <param name="app"></param>
|
|
/// <param name="token"></param>
|
|
/// <param name="messengerType"></param>
|
|
/// <returns></returns>
|
|
public static BotPagesApp AddTelegramAdapter(this BotPagesApp app, string token, string messengerType = "")
|
|
{
|
|
var telegram = new TelegramAdapter(app.Logger, token);
|
|
|
|
if (!string.IsNullOrWhiteSpace(messengerType)) telegram.MessengerType = messengerType;
|
|
|
|
app.AddAdapter(telegram.MessengerType, telegram);
|
|
return app;
|
|
}
|
|
}
|