rtrnGG & rtrnBOT

rtrnBOT is a multi-purpose Twitch and Discord bot. the bot features moderation, mini-games, custom commands and more!

Specs:

  • ReactJS

  • NodeJS

  • RabbitMQ*

  • MongoDB

  • Twitch API (Twurple)

  • vm2 (Code Exec)

  • Judge0* (Code Exec)

(*) Not Implemented


What is rtrn and rtrnBOT?

rtrn is a personal “brand” that I use for all of my newer applications. The name rtrn comes from the idea of “returning” control to the end-user, in this case, by giving users the tools they need to make both simple and complex Twitch bot interactions.

rtrnBOT is a personal project I have been working on to fill a gap I see on twitch. I see Twitch streamers using multiple bots to meet basic sets of features that a single bot should be able to do. The goal of rtrnBOT is to fill out these features. you can access the (very limited) beta site here.


Feature Set

Implemented

  • Default Commands

  • Custom Commands

  • AI Command Creation

In Progress

  • Code Functions

Not Implemented

  • Audit Log

  • Spam & Bot Prevention


Default Commands

These are commands necessary to use the bot, mainly just adding, removing, and editing commands, but in the future we may see some new additions.

Default Commands currently include:

  • !addcmd

  • !editcmd

  • !delcmd

Full documentation can be seen on the wiki, here.


Custom Commands

Custom Commands

These are commands generated by the user. Commands can either be created or edited in chat with the command !addcmd and !editcmd respectively, or through the website. Custom commands can also include variables listed below.

Variables

$(user)

  • The display name of the whoever used the command

$(channel)

  • The channel the command is used on

$(chatter)

  • A random “viewer” in chat

$(touser)

  • The first argument after a command, $(user) if missing

$(count)

  • This variable will be iterated with each use of the command

$(api_fetch URL)

  • Makes an http request to the provided URL and grabs the response

$(eval CODE)

  • Runs the js code provided and grabs the response


AI Command Creation

The bot includes some integration with OpenAI’s GPT-3.5-turbo model (ChatGPT). Through prompt engineering the AI is made aware of each command type and how to use variables. Its prompt engineering, yes.

For example the following will return…

  • Add a command to roll dice

    • Generated trigger (!roll, !rolldice, etc)

    • Generated response including javascript code in accordance to the variable use below

  • Add a command that says hi when someone says hello

    • Sets the name to “hello”

    • Sets the response to “hi”


Code Function

Interested in creating custom commands using your own code? rtrnBOT utilizes Judge0 for sandboxing and remote code execution, as shown in the example alongside this text.

Through Code Functions, creators can tap into the Twitch API to build their own micro bots, eliminating the need to dive deep into the complexities of creating bots from scratch.

What makes rtrnBOT unique is its online IDE, powered by Microsoft's Monaco Editor. This tool, combined with remote execution capabilities, allows creators to develop both simple and intricate bots.


Audit Log

The bot keeps a log of every change made to a command, who did it, and the ability to revert. It’s like a git but for chat commands.

Spam & Bot Prevention

Spam protection is a typical protection method where we simply check for users spamming the same message over and over and delete it or time them out.

Bot prevention sets out to remove the annoying “WaNnA bEcOmE fAmOuS” bots. Using the twitch API we can know when a message is a users first message in the channel. For every users first message in the channel, we can perform sentiment analysis. If the users first message appears to be an attempt at selling a service the user is timed out.


Systems Architecture