Beispiel #1
0
 public TelegramController(
     IUpdateParser updateParser,
     IOptionsSnapshot <TelegramConfiguration> options,
     ILogger <TelegramController> logger)
 {
     this.updateParser = updateParser;
     this.options      = options;
     this.logger       = logger;
 }
Beispiel #2
0
        /// <summary>
        /// Initializes a new Bot Manager
        /// </summary>
        /// <param name="bot">Bot to be managed</param>
        /// <param name="updateParser">List of update parsers for the bot</param>
        /// <param name="botOptions">Options used to configure the bot</param>
        public BotManager(TBot bot, IUpdateParser <TBot> updateParser, IOptions <BotOptions <TBot> > botOptions)
        {
            _bot          = bot;
            _updateParser = updateParser;
            _botOptions   = botOptions.Value;

            if (_botOptions.WebhookUrl != null)
            {
                WebhookUrl = ReplaceUrlTokens(_botOptions.WebhookUrl);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new Bot Manager
        /// </summary>
        /// <param name="bot">Bot to be managed</param>
        /// <param name="updateParser">List of update parsers for the bot</param>
        /// <param name="botOptions">Options used to configure the bot</param>
        /// <param name="logger"></param>
        public BotManager(TBot bot, IUpdateParser <TBot> updateParser, IOptions <BotOptions <TBot> > botOptions, ILogger <BotManager <TBot> > logger = null)
        {
            _bot          = bot;
            _updateParser = updateParser;
            this.logger   = logger;
            _botOptions   = botOptions.Value;

            if (_botOptions.WebhookUrl != null)
            {
                WebhookUrl = ReplaceUrlTokens(_botOptions.WebhookUrl);
            }
            logger?.LogInformation("Bot logging started");
        }