# \[Multi-Platform\] Play With Viewers Queue

**URL:** <https://extensions.streamer.bot/t/multi-platform-play-with-viewers-queue/1336>\
**Category:** Approved\
**Tags:** youtube, game-integration, moderation, trovo, chat, twitch\
**Created:** [May 8, 2024, 1:10pm UTC](https://extensions.streamer.bot/t/multi-platform-play-with-viewers-queue/1336 "2024-05-08T13:10:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mustached\_maniac](https://extensions.streamer.bot/user_avatar/extensions.streamer.bot/mustached_maniac/32/1227_2.png) [@mustached\_maniac](https://extensions.streamer.bot/u/mustached_maniac)\
**Post date:** [May 8, 2024, 1:10pm UTC](https://extensions.streamer.bot/t/multi-platform-play-with-viewers-queue/1336/1 "2024-05-08T13:10:18Z")

</div>

## 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](https://extensions.streamer.bot/uploads/default/original/2X/9/9d3aa3f7c8648e164790cffbd23c755bc09e1a2c.gif)

Kick integration assumes you are already using the [Kick.bot](https://github.com/Sehelitar/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](https://extensions.streamer.bot/uploads/short-url/o9MBMAsj83xCUYhAzLgWCjaGNWi.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`

 ![import actions](https://extensions.streamer.bot/uploads/default/original/2X/2/283bd38ee8595edebeecce25e6c943c58d650bc0.png)

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

 ![enable commands](https://extensions.streamer.bot/uploads/default/original/2X/e/eae73b4dd8ae84476b5c444ab24357fcf9f04151.png)

### Congratulations, installation and configuration are complete!

 ![triggers](https://extensions.streamer.bot/uploads/default/original/2X/b/bb001f344d5dad2eedf14f59b9e14538d9bfa328.png)

**SPECIAL NOTE:** You’ll notice _two_ triggers for every action. If you don’t use Kick and do not have the [Kick.bot](https://github.com/Sehelitar/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

---

<div class="post-metadata">

**Author:** ![pwnyy](https://extensions.streamer.bot/user_avatar/extensions.streamer.bot/pwnyy/32/2970_2.png) [@pwnyy](https://extensions.streamer.bot/u/pwnyy)\
**Post date:** [May 22, 2024, 3:43pm UTC](https://extensions.streamer.bot/t/multi-platform-play-with-viewers-queue/1336/2 "2024-05-22T15:43:24Z")

</div>

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:

```auto
	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);
				}
			}
		}
	}

```

---

<div class="post-metadata">

**Author:** ![mustached\_maniac](https://extensions.streamer.bot/user_avatar/extensions.streamer.bot/mustached_maniac/32/1227_2.png) [@mustached\_maniac](https://extensions.streamer.bot/u/mustached_maniac)\
**Post date:** [May 22, 2024, 10:16pm UTC](https://extensions.streamer.bot/t/multi-platform-play-with-viewers-queue/1336/3 "2024-05-22T22:16:32Z")

</div>

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