Skip to content
/ Tremble Public

[WIP] A high-level framework for creating your own private Twitch.tv bots in .NET.

License

Notifications You must be signed in to change notification settings

Frixuu/Tremble

Repository files navigation

Tremble

A high-level .NET 6 framework for creating your own private Twitch chatbots.

Quickstart

After you create a Twitch.tv account for your bot and generate the OAuth token, create a new .NET console app:

using Tremble;

await new TrembleBuilder()
    .WithIdentity("my-bot-name")
    .WithOauth("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
    .OnChannels("join-me", "also-join-me")
    .Build()
    .Run();

The commands you create are automatically picked up by Tremble. For example, here's how to make a command that will answer to whoever's calling !hello:

using Tremble.Chat;
using Tremble.Chat.Commands;
using Tremble.Chat.Commands.Attributes;

namespace HelloWorld;

[Command("hello")]
public class HelloCommand : Command
{
    private readonly TwitchChat _twitchChat;

    // Important modules will get injected through constructor
    public HelloCommand(TwitchChat twitchChat)
    {
        _twitchChat = twitchChat;
    }

    public override void Execute(in CommandInvocation invocation)
    {
        _twitchChat.SendMessage(invocation.ChannelName, $"Hello, {invocation.Sender.Name}!");
    }
}