© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
4 replies
DigitalOnyx

❔ 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?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

c# streamerbot execute code
C#CC# / help
9mo ago
Automapper 9.x.x - 10.x.x
C#CC# / help
4y ago
Autofac 5.x.x - 6.x.x
C#CC# / help
4y ago
DiscordPresence Issue
C#CC# / help
16mo ago