Ejemplo n.º 1
0
        public HelloBotProperties(IConfiguration configuration)
        {
            var telegram = configuration.GetSection("Telegram"); // JSON: "Telegram"
            var botToken = telegram["BotToken"];                 // ENV: Telegram__BotToken, JSON: "Telegram:BotToken"

            Api  = new BotClient(botToken);
            User = Api.GetMe();

            _commandHelper = new BotCommandHelper(this);

            // Delete my old commands
            Api.DeleteMyCommands();
            // Set my commands
            Api.SetMyCommands(
                new BotCommand("hello", "Hello world!"));

            // Delete webhook to use Long Polling
            Api.DeleteWebhook();
        }