Cross Chat Communication For Multistreaming On Twitch And YouTube

Description

With Twitch Opening Up MutliStreaming I Wanted To Create A Way For Twitch Chat and YouTube Chat to Communicate With Each other

Tutorial

Step 1.

Create 2 Actions 1 For Twitch Chat And 1 For YouTube Chat

Check Always Run

Give Each Action Its Own Queue

Step 2.

Add Twitch Chat Message Trigger To The Action For Twitch Chat

Twitch → Chat → Chat Message

Step 3.

Add An Execute C# Code Sub-Action To The Twitch Chat Action

Core → C# → Execute C# Code

Copy and Paste Code below into that Sub-Action

Compile That Code

Twitch Chat Code

//collect message from twitch viewers to send to youtube chat 

using System;

public class CPHInline
{
	public bool Execute()
	{
		//name of your bot on twitch
		string botName = "YOUR BOTS NAME HERE";
		// the emote you want to show in youtube chat so viewer know its from the other chat 
		// i used a BTTV emote for twitch logo
		string emote = "TWITCH ";
		// collect twitch chat message
		string message = args["message"].ToString();
		//collect user name of message
		string user = args["user"].ToString();
		//put together the message before sending to youtube chatt 
		string botMessage = emote + user + ": " + message;
		
		// a bool check to see if message was sent by your chatbot
		// anything your bot posts in chat will not be sent to the other chat  
		bool bot = string.Equals(user, botName, StringComparison.OrdinalIgnoreCase);
		
		 
		 if(!bot) //check if its your bot 
		 {
		 	//send message to youtube chat 
			CPH.SendYouTubeMessage($"{botMessage}");	
		}
		
		
		return true;
	}
}

Step 4.

Add YouTube Chat Message Trigger To The Action For YouTube Chat

YouTube → Chat → Message

Step 5.

Add An Execute C# Code Sub-Action To The YouTube Chat Action

Core → C# → Execute C# Code

Copy And Paste Code Below Into That Sub-Action

Compile That Code

YouTube Chat Code

//collect message from youtube chat to send to twitch chat 

using System;

public class CPHInline
{
	public bool Execute()
	{
		//name of youtube bot 
		string botName = "YOUR BOTS NAME HERE";
		// the emote you want to show in twitch chat so viewer know its from the other chat 
		// i used a BTTV emote for youtube logo
		string emote = "YOUTUBE ";
		// collect youtube chat message
		string message = args["message"].ToString();
		//collect user name of message
		string user = args["user"].ToString();
		// put together the message to send to twitch chat 
		string botMessage = emote + user + ": " + message;
		
		//a bool check to see if its a message sent by your bot 
       // anything your bot posts in chat will not be sent to the other chat 
		bool bot = string.Equals(user, botName, StringComparison.OrdinalIgnoreCase);
		
		 
		 if(!bot)//check if its your bot 
		 {
		 	//send message to twitch chat 
			CPH.SendMessage($"{botMessage}");	
		}
		
		
		return true;
	}
}

TEST CASE:

Precheck

Im Going To Use Multiple RTMP OBS Plugin To Multistream So This Test Case Will Be Based Around Using That
Link is below
Multiple RTMP OBS Plugin

MAKE SURE YOU HAVE LOGGED INTO BOTH TWITCH MAIN AND BOT AND YOUTUBE MAIN AND BOT INSIDE OF STREAMER BOT OR THIS WONT WORK

-To Test Your YouTube Must Be Live

  • Set Your YouTube Stream On YouTube To Unlisted So It Doesn’t Appear On Your Channel

  • Set Your Twitch Stream To Bandwidth Test (If You Care About Going Live On Your Twitch Channel

While You Test Otherwise Skip This Part)

By Adding ?bandwidthtest=true To The End Of Your Stream Key In OBS

REMEMBER TO REMOVE THIS FROM YOUR STREAM KEY AFTER YOU ARE DONE TESTING

Step 1

  • Click Start Stream In OBS (Twitch is my main Stream in OBS)

Step 2

If You Haven’t Checked Sync Start With OBS In The Plug-in Settings

  • Click Start Button In The RTMP OBS Plugin (This is Where I Start My YouTube Stream From)

Step 3

  • Now Type A Message In One Chat And It Should Get Posted By Your Bot In The Other Chat With

User Name And Message And Vice Versa

Thank You

I Hope This Extension Serves You Well

I Hope Something Happens To You Today That Makes You Smile :heart:

1 Like

Unfortunately there’s a few reasons that this can’t yet go through the approval process. First reason being the Submission Template - Check before submitting! was not followed. We need all posts to follow this format to keep all Extension pages looking uniform and so people can easily find things.

Another thing is Extensions are built out to make sure a user does not have to touch C# code unless there is no other choice. This is basically a step by step having the user build it not a built out Extension for plug and play use. If you look through all the Extensions here you will see they come with import files which contain everything built out already.

The last thing is this is currently against Twitch’s ToS. Yes, they have allowed for multistreaming but with a few Simulcasting Guidelines that must be followed. This being the one in question:


So anyone is welcome to do whatever they see fit with their own stream but we cannot in good faith put a submission through the approval process that is against Twitch’s ToS or guidelines. Hopefully they will further change their stance on simulcasting. However, as it stands now, chats can only be merged off the stream privately and not anywhere on Twitch’s platform during a broadcast.

Thank you for submitting this and I encourage you to share other things you may build with the community. Just keep this feedback in mind when submitting and we’ll be happy to put other things through the approval process.