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