示例#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.");
            }
        }
示例#2
0
        public void Process(TwitchClient client, string username, string commandText, bool isMod)
        {
            if (string.IsNullOrWhiteSpace(commandText))
            {
                client.SendMessage($"Hi @{username}, looks like you haven't included a request there!");
                return;
            }

            var(result, playlistPosition) = playlistHelper.AddRequest(username, commandText);
            if (result == AddRequestResult.PlaylistClosed)
            {
                client.SendMessage($"Hey @{username}, the playlist is currently closed. If you want to request a song still, try !vip");
            }
            else if (result == AddRequestResult.NoMultipleRequests)
            {
                client.SendMessage($"Hey @{username}, you can only have one non-vip request in the list!");
            }
            else
            {
                client.SendMessage($"Hey @{username}, I have queued {commandText} for you, you're #{playlistPosition} in the queue!");
            }
        }