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();
        }
Exemplo n.º 2
0
        public async Task <TdApi.User> Me()
        {
            var me = await _botClient.GetMe();

            return(me);
        }