예제 #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);
            }
        }
예제 #2
0
 public void SaveOrUpdateContext(BotContext context)
 {
     _botContexts.AddOrUpdate(context.Chat.Id, context, (key, val) => context);
 }