public static LoggerConfiguration Telegram( this LoggerSinkConfiguration loggerConfiguration, string token, string chatId, TelegramSink.RenderMessageMethod renderMessageImplementation = null, LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum, IFormatProvider formatProvider = null, ITelegramClientFactory telegramClientFactory = null ) { if (loggerConfiguration == null) { throw new ArgumentNullException(paramName: nameof(loggerConfiguration)); } return(loggerConfiguration.Sink( logEventSink: new TelegramSink( chatId: chatId, token: token, renderMessageImplementation: renderMessageImplementation, formatProvider: formatProvider, telegramClientFactory: telegramClientFactory ), restrictedToMinimumLevel: restrictedToMinimumLevel)); }
public TelegramSink(string chatId, string token, RenderMessageMethod renderMessageImplementation, IFormatProvider formatProvider, ITelegramClientFactory telegramClientFactory, IWebProxy proxy) { if (string.IsNullOrWhiteSpace(value: chatId)) { throw new ArgumentNullException(paramName: nameof(chatId)); } if (string.IsNullOrWhiteSpace(value: token)) { throw new ArgumentNullException(paramName: nameof(token)); } FormatProvider = formatProvider; this.proxy = proxy; if (renderMessageImplementation != null) { RenderMessageImplementation = renderMessageImplementation; } _chatId = chatId; _token = token; TelegramClientFactory = telegramClientFactory ?? new TelegramClientFactory(); }
public BotService(ITelegramBotClient telegramBotClient, IServiceProvider serviceProvider, MapperConfiguration mapperConfig, ITelegramClientFactory telegramClientFactory, IAccountService accountService, ILogger <BotService> logger) { _telegramBotClient = telegramBotClient; _logger = logger; _mapper = mapperConfig.CreateMapper(); _serviceProvider = serviceProvider; _telegramClientFactory = telegramClientFactory; _accountService = accountService; _started = false; Running = true; }
public TelegramHelper(ILogger <TelegramHelper> logger, ITelegramClientFactory telegramClientFactory) { _logger = logger; _telegramClientFactory = telegramClientFactory; }
public TLSharpTelegramClient(IOptionsSnapshot <ApiSettings> apiOptions, ITelegramClientFactory telClient) //, { _apiOptions = apiOptions ?? throw new ArgumentNullException(nameof(_apiOptions)); _telClient = telClient ?? throw new ArgumentNullException(nameof(_telClient)); }
public TelegramMessenger(ILogger <TelegramMessenger> logger, ITelegramClientFactory clientFactory, IOptions <PillsBotOptions> options) { _logger = logger; _options = options.Value; _clientFactory = clientFactory; }