public async void Process(TwitchClient client, string username, string commandText, bool isMod, JoinedChannel joinedChannel) { var promoteSongResponse = await _playlistApiClient.PromoteSong(new PromoteSongRequest { Username = username }); switch (promoteSongResponse.PromoteRequestResult) { case PromoteRequestResult.NotYourRequest: client.SendMessage(joinedChannel, $"Hey @{username}, I'm sorry but that request doesn't seem to belong to you. Please check your requests with !myrequests"); return; case PromoteRequestResult.UnSuccessful: client.SendMessage(joinedChannel, $"Hey @{username}, sorry I can't promote your request right now, please try again in a sec"); return; case PromoteRequestResult.NoVipAvailable: client.SendMessage(joinedChannel, $"Hey @{username}, sorry but you don't have a VIP to promote this request"); return; case PromoteRequestResult.Successful: client.SendMessage(joinedChannel, $"Hey @{username}, I have promoted your request to #{promoteSongResponse.PlaylistIndex} for you!"); return; } }
public async Task <IActionResult> PromoteRequest([FromBody] string songId) { if (User.Identity.IsAuthenticated) { var promoteRequestResult = await _playlistApiClient.PromoteSong( new PromoteSongRequest { SongRequestId = int.Parse(songId), Username = User.Identity.Name.ToLower() }); switch (promoteRequestResult.PromoteRequestResult) { case PromoteRequestResult.NotYourRequest: return(BadRequest(new { Message = "This is not your request. Please try again" })); case PromoteRequestResult.AlreadyVip: return(BadRequest(new { Message = "This request has already been promoted! Congratulations" })); case PromoteRequestResult.NoVipAvailable: return(BadRequest(new { Message = "Sorry but you don't seem to have a VIP token" })); case PromoteRequestResult.Successful: return(Ok()); default: return(BadRequest(new { Message = "An error occurred, please wait until the issue is resolved" })); } } return(BadRequest(new { Message = "It looks like you're not logged in, log in and try again" })); }