PNGTuber-GPT - An extension for Streamer.bot and Speaker.bot that brings AI to life for your Twitch stream

This extension requires you to have a paid OpenAI account and API key to use. The core extension is open-source and free, but there will be platform costs associated with usage.

Description

An extension for Streamer.bot and Speaker.bot that brings AI to life for your Twitch stream. PNGTuber-GPT is built to make it easy for you to bring an AI character to life that can interact with your Twitch chat, and learn from your channel. It acts as you command it to, and can learn things from your viewers. All powered by ChatGPT. This solution’s core is a C# extension for Streamer.bot and utilizes Speaker.bot for it’s Text-to-Speech functionality. We are proud to be part of a rich ecosystem of extensions that you can use on your channel. No other software is required.

Video Tutorial

Import Code

PNGTuber-GPT.sb (53.4 KB)

Resources

Installation

In Streamer.bot click the Import button in the top menu. Drag the PNGTuber-GPT.sb file into the Import String field.

Create OpenAI Account

To access ChatGPT 3.5 Turbo, you need to have an active OpenAI account to retrieve an API key to use to send their API prompts from Streamer.bot. Signup for a new account on their website. Make sure to link a payment method to your account and convert to a paid account. By default your account has a hard limit of $120 per month, and you must request an increase to this limit if you should need more.

Retrieve OpenAI API Key

Login to the OpenAI website, and navigate to your user in the top-right corner and click on “View API Keys.” Create a new secret key, and then save this for later. DO NOT lose this key or give it to anyone you don’t want to be able to charge your account. MAKE SURE YOU HAVE CONVERTED TO A PAID ACCOUNT BEFORE GENERATING YOUR API KEY! If not you will receive a (429) Too many requests error in the log file.

Create GPT Bot Lore Text File

Your GPT bot needs to have a personality, backstory, likes, and dislikes. The better you build the deep lore, the more context the bot will respond to. You can “teach” the bot things by changing the wording of your lore file. You are basically digging into the AI’s brain and modifying their personality. Be creative, if you want your bot unhinged, tell them to be unhinged. You can also give negative prompting by telling them not to exhibit certain behaviors. A sample Lore file is provided below. You should save this as a text document. It is important to have a Traits section, Instructions, and a task that you expect them to do.

Download the context file from above and make sure context.txt is in your bot directory.

Configuration

Settings Configurations

OpenAI API Key - Your OpenAI API Key for accessing the OpenAI platform
OpenAI Model - Either gpt-3.5-turbo or gpt-4
Database Path - The path to the folder that has your context.txt in it
Ignore Bot Usernames - A comma separated list of bot names to not save messages for
Voice Alias - The voice alias to speak through
Strip Emojis From Response - Whether to strip emojis that are returned in the response from GPT
Logging Level - ERROR | WARN | INFO | DEBUG - indicates the logging level that should be output. Logs are saved to the Database Path under a logs directory.
Version - Allows you to customize the version shown in chat when the !version command is run

Moderation Settings

Each category can have a status of True or False. True indicates that category should not be moderated. False means that moderation will block responses that flag in that category.

Discord Settings

Log GPT Questions to Discord - True will log messages to Discord, False will disable this functionality
Discord Webhook URL - The webhook URL to log messages to
Discord Bot Username - The username to log messages as
Discord Avatar URL - A URL to an image to use for the profile picture on Discord for messages

Commands

Command Description
!modgpt {input} Allows moderators to ask the bot a question
!modteach Allows a moderator to teach the bot something about themselves
!modrememberthis {keyword} {definition} Allows moderators to save a keyword and definition for the bot to remember
!modforgetthis {keyword} Allows moderators to make the bot forget a keyword and definition
!curentnick Returns the user’s current nickname in chat
!getmemory Return what the bot remembers about that user
!help Return a list of available commands
!modclearchathistory Clears the chat log sent to the bot with each response
!modclearprompthistory Clears the chat log sent to the bot with each response
!modforget Clears what the bot remembers about the moderator
!modreinitialize Re-initializes the bot and global variables to memory
!removenick Remove’s the user’s nickname from memory
!sayplay Gets the bot to say !play for playing Marbles on Stream with viewers
!setnick {input} Sets the user’s nickname that is sent to the bot with the chatlog and prompts
!setpronouns Returns information on how the user can set their pronouns sent to the bot
!speak {input} Allows mods to access TTS, and say what they want on stream
4 Likes

Seems to be looking good, the only “issue” I would see would be that there is no direct link to the github page or direct download in the post to download the context.txt.
Had to look around a bit til I actually saw the github link in the header of the website as in the post it mentions " Download the context file from above" which can be misinterpreted as above there should have been another file to download.

Edit: Adding to this I just realized that certain .dll’s are not able to be located as they are references to folder you have. Compiles fine but can probably just remove those references lol

Microsoft.Bcl.AsyncInterfaces.dll
System.Threading.Tasks.Extensions.dll
Newtonsoft.Json.dll
Microsoft.CodeAnalysis.dll
System.Collections.Immutable.dll
System.Text.Encodings.Web.dll

Sorry for the lack of reply here. I’ve been busy trying to get 1.1 finished. I did remove those references in the latest nightly. The reason that it said “download the context file from above” was originally I had both the GitHub link and the context file download above in Resources; but I ran into a technical issue where I didn’t seem to have the permissions to add more links to the post. I tried editing it after and got the same error. Perhaps you can grant me the permissions needed, and I can update it appropriately. Once I get 1.1 out I will return and resubmit this for approval. There are a number of changes that need to still be reflected here.

Whenever you have issues with permissions of your post please let us know either on the Extension or SB Discord, probably best in the Extension one. That way we might see it earlier and can check on it :slight_smile: Just let us know when you update it to 1.1 that way we can review it again!