예제 #1
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);
            }
        }
예제 #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>
        /// <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");
        }
 /// <summary>
 /// Initializes a new Bot
 /// </summary>
 /// <param name="botOptions">Options used to configure the bot</param>
 protected BotBase(IOptions <BotOptions <TBot> > botOptions)
 {
     BotOptions = botOptions.Value;
     Client     = new TelegramBotClient(BotOptions.ApiToken);
 }