DigitalOnyx
DigitalOnyx
CC#
Created by DigitalOnyx on 2/23/2023 in #help
❔ 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;
}
}
So I'm trying to adapt this code so not only does it post to my twitch chat (Which is does and that side of this is perfectly fine) All I need to do now is find a way to post it to a Discord Channel via a Webhook?
5 replies