예제 #1
0
        public AnswerContext(
            string fullCommand,
            Message message,
            BotDbContext context,
            ITelegramClient bot,
            IOptionsSnapshot <TelegramOptions> options,
            IOmbiService ombiAdmin,
            IBotOmbiService ombi,
            ILogger <AnswerContext <TProgression> > logger
            )
        {
            Message   = message;
            Database  = context;
            Bot       = bot;
            Options   = options;
            OmbiAdmin = ombiAdmin;
            Ombi      = ombi;
            Logger    = logger;

            if (Message != null)
            {
                User = Database.BotUsers.FirstOrDefault(x => x.TelegramId == Message.Chat.Id);
            }

            if (fullCommand != null)
            {
                var parameters = fullCommand.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                var queue      = new Queue <string>(parameters);

                Command    = queue.Dequeue();
                Parameters = queue.ToArray();
            }
        }
예제 #2
0
 public MessageAnswerContext(
     DataCapture <Message> capture,
     BotDbContext context,
     ITelegramClient bot,
     IOptionsSnapshot <TelegramOptions> options,
     IOmbiService ombiAdmin,
     IBotOmbiService ombi,
     ILogger <MessageAnswerContext <TProgression> > logger
     ) : base(capture.Data?.Text, capture?.Data, context, bot, options, ombiAdmin, ombi, logger)
 {
 }
예제 #3
0
        public MonitoringController(
            ITelegramClient bot,
            IOmbiService ombi,
            IConfigurationRoot configuration
            )
        {
            _bot  = bot;
            _ombi = ombi;

            var pattern = configuration.GetSection("Serilog:WriteTo:1:Args:path").Get <string>();

            _logsfolder = Path.GetDirectoryName(pattern);
        }