Trotbot Redux: Extensible API

Semi-free Trotbot Redux: Extensible API v1.1.9.32 Console

Trotbot Redux

Summary
Alone, this is a program that connects to Twitch chat rooms with the required user credentials just as any other IRC client would. It also allows for chatting through the console from the bot. Though, seeing as that would not be efficient, there are hooks in the program that allow for building plugins to automate tasks.

Details
It takes some knowledge of the programming language C# upon which this bot is build off of. It also requires a basic understanding of the IRC protocol for use of commands such as how to send messages down the pipeline. IRC information in detail can be found here: http://www.faqs.org/rfcs/rfc2812.html. This chat bot is built using .NET Core meaning it is compatible with Linux distros (not tested, just conjecture).

The non-free version can be found here:
Software Distributor Information and Page

Plugin Examples
These are provided within the download package as pre-built plugins.
On Join raw
C#:
[ApiVersion(0, 1)]
    public class Plugin : TwitchBot
    {
        public override Version Version => new Version(1, 0, 0, 0);
        public override string Name => "Basic commands";

        public override void Initialize()
        {
            Data = new DataStore("command_data");
            ChatRoom.UserCommandEvent += OnCommand;
        }
        public override void Dispose()
        {
            ChatRoom.UserCommandEvent -= OnCommand;
            Data.WriteToFile();
        }

        private void OnCommand(object sender, ChatRoom.CommandEventArgs e)
        {
            ChatRoom chat = ChatRoom.Instance;
            string prefix = (Send + channel + " @" + e.User + " :").Normalize();
            string prefix2 = (Send + channel + " :").Normalize();
            string cmd = "";
            string command = e.Message.Substring(1).ToLower().Normalize();

            if (Data.BlockExists(command))
            {
                chat.SendMessage(prefix2 + Data.GetBlock(command).GetValue(Parameters[1]));
                return;
            }
            if (channel == e.User)
            {
                if (command.StartsWith("create"))
                {
                    if (!command.Contains(" "))
                    {
                        chat.SendMessage(prefix2 + "There is no command title, therefore this command was ignored.");
                        return;
                    }
                    cmd = command.Substring(command.IndexOf(" ") + 1);
                    if (cmd.Contains(" "))
                    {
                        chat.SendMessage(prefix2 + "Command title contains a space, therefore this command was ignored.");
                        return;
                    }
                    if (!Data.BlockExists(cmd))
                    {
                        Data.NewBlock(Parameters, cmd);
                        chat.SendMessage(prefix2 + "Command [" + cmd + "] made. Now use the command <edit <command name>> to change it's contents.");
                    }
                    else
                    {
                        chat.SendMessage(prefix2 + "This command has already been made.");
                    }
                    return;
                }
                else if (command.StartsWith("edit"))
                {
                    if (!command.Contains(" "))
                        return;
                    string[] split = command.Split(' ');
                    if (split.Length < 3)
                    {
                        chat.SendMessage(prefix2 + "Command edit using insufficient parameters.");
                        return;
                    }
                    cmd = split[1];
                    if (Data.BlockExists(cmd))
                    {
                        Block block = Data.GetBlock(cmd);
                        block.WriteValue(Parameters[1], e.Message.Substring("edit".Length + cmd.Length + 3));
                        chat.SendMessage(prefix2 + "Command description modified.");
                    }
                    else
                    {
                        chat.SendMessage(prefix2 + "Command does not exist.");
                    }
                }
            }
        }
}
Previews
Console view:
in-app.png


Chat Commands and Welcome plugins in Twitch's chat:
t-chat.png
  • Like
Reactions: gatekeeper1122
Author
700hours
Downloads
296
Views
1,827
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from 700hours

Latest updates

  1. v1.1.9.32

    Hello again, So short a time has passed yet there are more developments. Future uploads of the...
  2. v1.1.9.30

    Hello, Since last update there have been two new vanilla plugins added. These will be included...
  3. Update v1.1.8.24

    Hello, This marks another update to the API, though minor. It fixes the user color information...
Top