Esempio n. 1
0
        private async Task HandleUserMessageAsync(ITelegramBotApi api, Update update)
        {
            User   from   = update.Message.From;
            Chat   chat   = update.Message.Chat;
            long   userId = update.Message.From.Id;
            string text   = update.Message.Text ?? "";

            string[] commandItems = text.Split(' ');

            if (commandItems.Length < 1)
            {
                return;
            }

            if (UserState <UserDetails> .ExistsFor(userId) && UserState <UserDetails> .LoadOrDefault(userId).Data.AuthValid)
            {
                await HandleAuthenticatedUserCommand(api, update, from, chat, userId, commandItems);
            }
            else
            {
                await HandleNonAuthenticatedUserCommand(api, update, from, chat, userId, commandItems);
            }
        }