Esempio n. 1
0
        private void SaveContextActivity(Message message)
        {
            var context = new BotContext {
                Chat = message.Chat, LastCommand = message.Text
            };
            var currentContext = BotStorage.GetBotContextByChatId(message.Chat.Id);

            if (currentContext == null)
            {
                BotStorage.SaveOrUpdateContext(context);
            }
            else
            {
                currentContext.Context = context;
                BotStorage.SaveOrUpdateContext(currentContext);
            }
        }
Esempio n. 2
0
 public void SaveOrUpdateContext(BotContext context)
 {
     _botContexts.AddOrUpdate(context.Chat.Id, context, (key, val) => context);
 }