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); }
public async Task <IActionResult> GetUsers() { var users = await _mumbleInfo.GetUsersAsync(); return(Ok(users)); }
public async Task <IActionResult> Index() { var users = await _mumbleInfo.GetUsersAsync(); return(View(users.Select(x => x.Username).ToArray())); }