Пример #1
0
        public Task Execute(IChatClient chatClient, ChatCommandEventArgs e)
        {
            lock (_mutex)
            {
                if (chatClient.GetType().ToString() == e.ClientType)
                {
                    if (_adventureGame is null)
                    {
                        _adventureGame = new AdventureGame();
                    }

                    _adventureGame.HandleCommand(chatClient, e);
                }
            }

            return(null);
        }
Пример #2
0
        private void DoTheThing(CommandReceivedEventArgs e, IChatClient chatClient, IBotCommand botCommand)
        {
            CommandUsage commandUsage       = AttemptToRunCommand(e, botCommand, chatClient);
            var          commandUsageEntity = new CommandUsageEntity(e.CommandWord, botCommand.GetType().FullName,
                                                                     e.ChatUser.UserId, e.ChatUser.DisplayName, chatClient.GetType().Name);

            _repository.Create(commandUsageEntity);
            _usageTracker.RecordUsage(commandUsage);
        }