❔ StreamerBot x Discord
using System;
using System.Runtime;
using Twitch.Common.Models.Api;
public class CPHInline
{
public bool Execute()
{
// Get arguments
string user = args.ContainsKey("user") ? args["user"].ToString() : "";
// Clips take a few seconds to publish, so notify chat that a clip is being created
CPH.SendMessage($"/me Creating a clip...");
// Create the clip
ClipData clip = CPH.CreateClip();
// Twitch does not publish clips with copyrighted content, so notify user if nothing comes back
if (clip == null)
{
CPH.SendMessage($"/me {user} could not create clip");
return true;
}
// Add clip properties as arguments so they can be used in additional subactions if needed
CPH.SetArgument("Id", clip.Id);
CPH.SetArgument("Url", clip.Url);
CPH.SetArgument("EmbedUrl", clip.EmbedUrl);
CPH.SetArgument("BroadcasterId", clip.BroadcasterId.ToString());
CPH.SetArgument("BroadcasterName", clip.BroadcasterName);
CPH.SetArgument("CreatorId", clip.CreatorId.ToString());
CPH.SetArgument("CreatorName", clip.CreatorName);
CPH.SetArgument("VideoId", clip.VideoId);
CPH.SetArgument("GameId", clip.GameId);
CPH.SetArgument("Language", clip.Language);
CPH.SetArgument("Title", clip.Title);
CPH.SetArgument("ViewCount", clip.ViewCount.ToString());
string createdAt = clip.CreatedAt.ToString("d MMM yyyy @ hh:mm tt");
CPH.SetArgument("CreatedAt", createdAt);
CPH.SetArgument("ThumbnailUrl", clip.ThumbnailUrl);
CPH.SetArgument("Duration", clip.Duration.ToString());
// Send Twitch chat message
CPH.SendMessage($"/me {user} created a clip - {clip.Url}");
return true;
}
}
using System;
using System.Runtime;
using Twitch.Common.Models.Api;
public class CPHInline
{
public bool Execute()
{
// Get arguments
string user = args.ContainsKey("user") ? args["user"].ToString() : "";
// Clips take a few seconds to publish, so notify chat that a clip is being created
CPH.SendMessage($"/me Creating a clip...");
// Create the clip
ClipData clip = CPH.CreateClip();
// Twitch does not publish clips with copyrighted content, so notify user if nothing comes back
if (clip == null)
{
CPH.SendMessage($"/me {user} could not create clip");
return true;
}
// Add clip properties as arguments so they can be used in additional subactions if needed
CPH.SetArgument("Id", clip.Id);
CPH.SetArgument("Url", clip.Url);
CPH.SetArgument("EmbedUrl", clip.EmbedUrl);
CPH.SetArgument("BroadcasterId", clip.BroadcasterId.ToString());
CPH.SetArgument("BroadcasterName", clip.BroadcasterName);
CPH.SetArgument("CreatorId", clip.CreatorId.ToString());
CPH.SetArgument("CreatorName", clip.CreatorName);
CPH.SetArgument("VideoId", clip.VideoId);
CPH.SetArgument("GameId", clip.GameId);
CPH.SetArgument("Language", clip.Language);
CPH.SetArgument("Title", clip.Title);
CPH.SetArgument("ViewCount", clip.ViewCount.ToString());
string createdAt = clip.CreatedAt.ToString("d MMM yyyy @ hh:mm tt");
CPH.SetArgument("CreatedAt", createdAt);
CPH.SetArgument("ThumbnailUrl", clip.ThumbnailUrl);
CPH.SetArgument("Duration", clip.Duration.ToString());
// Send Twitch chat message
CPH.SendMessage($"/me {user} created a clip - {clip.Url}");
return true;
}
}
4 Replies
Do you have the webhook URL and stuff already set up?
Aye that I do
So all you need to do is make a http request to that endpoint?
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.