コード例 #1
0
        public static async Task Main(string[] args)
        {
            var config = BotConfigLoader.LoadFromStaticFile();

            var bot = new DeveHangmanTelegramBot(config);
            await bot.Start();
        }
コード例 #2
0
        public async Task StartTelegramBot()
        {
            var config = BotConfigLoader.LoadFromEnvironmentVariables(Configuration);

            if (!config.IsValid)
            {
                config = BotConfigLoader.LoadFromStaticFile();
            }

            if (!config.IsValid)
            {
                DirtyMemoryLogger.LoggingLines.Add($"{DateTime.Now}: Bot configuration not valid");
            }

            var extraLogger = new DateTimeLoggerAppender(new DirtyMemoryLogger(LogLevel.Verbose), ": ");
            var telegramBot = new DeveHangmanTelegramBot(config, extraLogger);

            await telegramBot.Start();
        }