Example #1
0
        public static async Task ProcessMessage(TelegramShopClient telegramShop, MessageEventArgs e)
        {
            var user = ShopUserRepository.GetUser(e.Message.From);

            await telegramShop.Log($"Message from @{user.Telegram} - {e.Message.Text}");

            try
            {
                if (await SpamHandler.IsSpamming(telegramShop, e, user))
                {
                    return;
                }

                await GetMenuProcessor(user, e).Process(telegramShop, e, user);
            }
            catch (Exception ex)
            {
                await telegramShop.SendMessage(
                    e.Message.Chat.Id,
                    AnswerMessage.ErrorOnRequestProcessing + ex.Message,
                    TelegramShopMessageHandler.GetKeyboard(user.CurrentDialogState));
            }
        }