예제 #1
0
        public async Task OnHandle(UserListRequested message, string name)
        {
            var users = await _mumbleInfo.GetUsersAsync();

            if (users.Length == 0)
            {
                await _messageBus.Publish(new SendTextMessage("No users connected"));
            }
            else
            {
                var userListText = string.Join("\r\n", users.Select(x => x.Username));
                await _messageBus.Publish(new SendTextMessage(userListText));
            }

            _logger.LogInformation("User list requested by {Requester}", message.Requester);
        }
예제 #2
0
        public async Task <IActionResult> GetUsers()
        {
            var users = await _mumbleInfo.GetUsersAsync();

            return(Ok(users));
        }
예제 #3
0
        public async Task <IActionResult> Index()
        {
            var users = await _mumbleInfo.GetUsersAsync();

            return(View(users.Select(x => x.Username).ToArray()));
        }