Hey guys i have a question i work onmy MultiStream Extension and i was thinking it would be good if people can @Name in there title even if the person is not live.
Currently it takes everyone in the title and put it in a list and post it as a multilink
someone suggest i should try it with DecAPI Docs but i never did a http request before in C#
would be nice if someone could help me out (maybe splitting this into 2 part would be good ? ) 1 script for checking title and checking if he/she is live and another script for putting all toughter ?
using System;
using System.Collections.Generic;
using System.Linq;
public class CPHInline
{
public bool Execute()
{
//Get Broadcaster Infos
string title = args["targetChannelTitle"].ToString(); CPH.LogVerbose("GET TITLE");
string broadcaster = args["targetUser"].ToString(); CPH.LogVerbose("GET BROADCASTER");
//Get Input (for command) example: !multistream
string input= args.ContainsKey("rawInput") ? args["rawInput"].ToString() : "notimedaction"; CPH.LogVerbose("GET INPUT");
string messageMulti = args["messageMulti"].ToString(); CPH.LogVerbose("GET MULTIMESSAGE");
string messageNoMulti = args["messageNoMulti"].ToString(); CPH.LogVerbose("GET NOMULTI");
//Get Action Settings
string streamService = args["streamService"].ToString(); CPH.LogVerbose("GET STREAMSERVICE");
//Set all lists
List<string> formattedStreamers = new List<string>(); CPH.LogVerbose("GET FORMATTEDSTREAMERS LIST" );
List<string> streamers = new List<string>(); CPH.LogVerbose("GET STREAMERS LIST");
// Parse Stream Title
string formattedStreamer = ""; CPH.LogVerbose("GET FORMATTEDSTREAMER STRING");
string[] words = title.Split(' '); CPH.LogVerbose("GET WORDS");
foreach (string word in words)
{ CPH.LogVerbose("SEPERATE WORDS");
if (word.StartsWith("@"))
{
streamers.Add(word.Substring(1)); // remove the "@"
}
}
// Set Streamers for Multilink
if(streamers.Any())
{ CPH.LogVerbose("REPLACE @");
foreach (string streamer in streamers)
{
formattedStreamer = streamer.Replace(" ", ""); // remove spaces from the name
formattedStreamers.Add(formattedStreamer);
}
string streamerList = string.Join("/", formattedStreamers);
CPH.SendMessage(messageMulti + " " + streamService + broadcaster + "/" + streamerList);
} else{
if(input == "")
{
CPH.SendMessage(messageNoMulti);
} else {
CPH.LogVerbose("NO MULTI");
}
}
return true;
}
}