[Multi-Platform] Play With Viewers Queue

Description

Ever wanted to keep track of who has the next game? Now your viewers can jump in the queue, or moderators can manually add them…all with just a chat command. Multi-Platform support meaning viewers from Twitch, YouTube, Trovo, (and yes even Kick), can get in line to have a turn playing with the most mediocre streamer they know! This extension will work whether you stream to any of the single listed platforms, or any combination of all four!!

The viewer queue displays which platform a viewer joined from (as well as the gamer tag) and is stored in a persisted global variable (in case your queue gets very large and you’re unable to play with everybody in the current streaming session). It can be manually cleared via command and has the option to either go in order through the list, or pull a random viewer.

Current Version: 1.1.5, updated to include Streamdeck support for Check Next Player(s), Select Random Player, Remove Player, and Clear Player Queue Actions. If using the SD with ‘Check Next Player(s)’ Action, you must add an argument named numPlayers and set it to whatever value you want to check.

Example Play with Viewers

Kick integration assumes you are already using the Kick.bot extension created by @sehelitar. I am NOT a contributor to that project, simply added support for it here to expand the functionality of the ‘Play with Viewers’ queue.

Import Code

Mustached_Maniac_Play_with_Viewers [MP].sb (13.7 KB)

Installation

In Streamer.bot click the Import button in the top menu. Drag the downloaded .sb file into the Import String field and click Import . You will see 7 Actions and 7 Commands

Once imported, head over to the Commands tab and Right-Click on the group named [Multi-Platform] Play With Viewers to Enable All commands

Congratulations, installation and configuration are complete!

SPECIAL NOTE: You’ll notice two triggers for every action. If you don’t use Kick and do not have the Kick.bot extension installed, those triggers do not apply to you and will not affect how the extension works. (Feel free to delete them, or just leave them alone)

Commands

For Broadcaster/Moderators:

Command Description
!addPlayer Requires username (i.e. !addplayer @mustached_maniac) and can optionally include the Gamer Tag after their name, well as platform
!removePlayer Requires either username or position number in queue (i.e. !removePlayer 2 or !removePlayer @mustached_maniac)
!randomPlayer Selects a random player from the queue
!clearQueue Clears the player queue

For Viewers:

Command Description
!join XXX Joins the ‘player waiting’ queue, can add Gamer Tag after !join in the command
!checkQueue Displays their current position in the queue
!nextPlayer Will display the next viewer to play, can be used with a number to display next ‘X’ viewers (i.e. !nextPlayer 3 will display the next 3 viewers)
!leave Leaves the ‘player waiting’ queue

Example use:

!addPlayer @mustached_maniac MMgamerTag youtube would add the user mustached_maniac to the queue and store their gamer tag, then send a chat message like this:

@mustached_maniac (youtube) [MMgamerTag] - was added to the ‘players waiting’ queue in position 1

!join without including a gamer tag, would show a message like this in the chat:

@maniac_b0t (twitch) [No Gamer Tag] - has been added to the ‘players waiting’ queue in position 2

3 Likes

Currently some problems I saw were for example if a different user has the same name as another on a different platform as currently you are only checking whether the name exists in the list, best would probably be to also check the platform the name is on. That would remove some of the problems.

One other thing I personally wouldn’t consider “issue” but it’s still something that can be avoided would be to make sure you are getting rid of the 7TV white character as if someone were to write !nextplayer twice and they have 7TV enabled it will send an error “Please provide a valid number of players to view.”.
You can do that by using this code at the start with a method in the execute:

	public void Remove7TVWhiteSpace()
	{
		if(CPH.TryGetArg("rawInput",out string rawInput))
		{
			if(rawInput.IndexOf("󠀀") != -1)
			{
				rawInput = rawInput.Replace("󠀀","");
				rawInput = rawInput.Trim();
				args["rawInput"] = rawInput;
				CPH.SetArgument("rawInput",rawInput);
				string[] inputList = rawInput.Split(' ');
				int i = 0;
				while(CPH.TryGetArg("input"+i, out string input))
				{
					string newInput = input.Replace("󠀀","").Trim();
					args["input"+i] = newInput;
					CPH.SetArgument("input"+i,newInput);
				}
			}
		}
	}
1 Like

Updated import to handle checking platforms when adding/removing, also includes removing the randomly selected viewer AND incorporated the 7TV hack (where applicable).

2 Likes