Streamerbot / docs

Official documentation for Streamer.bot
https://docs.streamer.bot
8 stars 55 forks source link

Documentation needed: Update custom triggers documentation #119

Open Whipstickgostop opened 6 months ago

Whipstickgostop commented 6 months ago

Describe the missing documentation Add additional context for registering custom triggers within Init()

Where do you think this documentation should be included? An existing page or new page? https://docs.streamer.bot/guide/triggers#custom-triggers

Additional context From @Rhondi Discord Post

When registering custom triggers, it's best practice to register them in the public void Init() method. And also adjust the Execute C# Code sub-action to Precompile on Application Start

image

public void Init()
{
    CPH.RegisterCustomTrigger("New Twitch Clip Found", "clip_found", new[] {"Twitch"});
}

image

rondhi commented 6 months ago

image

You can even nest deeper categories this way

public void Init()
{
    CPH.RegisterCustomTrigger("Poll Ended", "poll_ended", new[] {"Chat Based Poll"});
    CPH.RegisterCustomTrigger("Poll Canceled", "poll_canceled", new[] {"Chat Based Poll"});
    CPH.RegisterCustomTrigger("Poll Status", "poll_status", new[] {"Chat Based Poll"});
    CPH.RegisterCustomTrigger("Poll Message Winner", "poll_winner_one", new[] {"Chat Based Poll", "Winner"});
    CPH.RegisterCustomTrigger("Poll Message Tie 2", "poll_winner_two", new[] {"Chat Based Poll", "Winner"});
    CPH.RegisterCustomTrigger("Poll Message Tie 3", "poll_winner_three", new[] {"Chat Based Poll", "Winner"});
}