Esempio n. 1
0
        public void Process(TwitchClient client, string username, string commandText, bool isMod)
        {
            if (string.IsNullOrWhiteSpace(commandText))
            {
                client.SendMessage($"Hey @{username}, looks like you haven't included a request there!");
                return;
            }

            if (vipHelper.CanUseVipRequest(username))
            {
                var playlistPosition = 0;
                var songIndex        = 0;
                if (int.TryParse(commandText.Trim('#'), out songIndex))
                {
                    playlistPosition = playlistHelper.PromoteRequest(username, songIndex - 1);
                    client.SendMessage(playlistPosition == -1
                        ? $"Hey @{username}, I can't find a song at that position! Please check your requests with !myrequests"
                        : playlistPosition == -2
                            ? $"Hey @{username}, I'm sorry but that request doesn't seem to belong to you. Please check your requests with !myrequests"
                            : playlistPosition == 0
                                ? $"Hey @{username}, something seems to have gone wrong. Please try again in a minute or two"
                                : $"Hey @{username}, I have promoted #{commandText} to #{playlistPosition} for you!");

                    if (playlistPosition > 0)
                    {
                        vipHelper.UseVipRequest(username);
                    }
                    return;
                }

                (_, playlistPosition) = playlistHelper.AddRequest(username, commandText, true);
                vipHelper.UseVipRequest(username);
                client.SendMessage(
                    $"Hey @{username}, I have queued {commandText} for you, you're #{playlistPosition} in the queue!");
            }
            else
            {
                client.SendMessage(
                    $"Hey @{username}, it looks like you don't have any remaining VIP requests. Please use the standard !request command.");
            }
        }