Important Notice: Cyclic is no longer supported for deployment. Please use Render for deploying this bot.
Your support means the world to me! ❤️
☕ Buy me a coffee to support me ☕
Join our Discord community:
This is a simple Node.js chatbot with ChatGPT integration, designed to work with Twitch streams. It uses the Express framework and can operate in two modes: chat mode (with context of previous messages) or prompt mode (without context of previous messages).
- Responds to Twitch chat commands with ChatGPT-generated responses.
- Can operate in chat mode with context or prompt mode without context.
- Supports Text-to-Speech (TTS) for responses.
- Customizable via environment variables.
- Deployed on Render for 24/7 availability.
Login to GitHub and fork this repository to get your own copy.
Open file_context.txt
and write down all your background information for GPT. This content will be included in every request.
Create an account on OpenAI and set up billing limits if necessary.
Generate an API key on the API keys page and store it securely.
Render allows you to run your bot 24/7 for free. Follow these steps:
Click the button below to deploy:
Log in with your GitHub account and select your forked repository for deployment.
Go to the variables/environment tab in your Render deployment and set the following variables:
OPENAI_API_KEY
: Your OpenAI API key.
GPT_MODE
: (default:CHAT
) Mode of operation, can beCHAT
orPROMPT
.
HISTORY_LENGTH
: (default:5
) Number of previous messages to include in context.MODEL_NAME
: (default:gpt-3.5-turbo
) The OpenAI model to use. You can check the available models here.COMMAND_NAME
: (default:!gpt
) The command that triggers the bot. You can set more than one command by separating them with a comma (e.g.!gpt,!chatbot
).CHANNELS
: List of Twitch channels the bot will join (comma-separated). (e.g.channel1,channel2
; do not include www.twitch.tv)SEND_USERNAME
: (default:true
) Whether to include the username in the message sent to OpenAI.ENABLE_TTS
: (default:false
) Whether to enable Text-to-Speech.ENABLE_CHANNEL_POINTS
: (default:false
) Whether to enable channel points integration.COOLDOWN_DURATION
: (default:10
) Cooldown duration in seconds between responses.
TWITCH_AUTH
: OAuth token for your Twitch bot.- Go to https://twitchapps.com/tmi/ and click on Connect with Twitch
- Copy the token from the page and paste it in the TWITCH_AUTH variable
⚠️ THIS TOKEN MIGHT EXPIRE AFTER A FEW DAYS, SO YOU MIGHT HAVE TO REPEAT THIS STEP EVERY FEW DAYS⚠️
Your Render URL (e.g., https://your-twitch-bot.onrender.com/
) can be added as a widget to your stream for TTS integration.
You can interact with the bot using Twitch chat commands. By default, the command is !gpt
. You can change this in the environment variables.
To use the !gpt
command:
!gpt What is the weather today?
The bot will respond with an OpenAI-generated message.
Create a custom command with the response:
$(urlfetch https://your-render-url.onrender.com/gpt/"${user}:${queryescape ${1:}}")
Create a custom command with the response:
!addcom !gptcmd $(urlfetch https://twitch-chatgpt-bot.onrender.com/gpt/$(user):$(querystring))
Replace your-render-url.onrender.com
with your actual Render URL.
Replace gptcmd
with your desired command name.
Remove $(user):
if you don't want to include the username in the message sent to OpenAI.
For any issues or questions, please join our Discord community.
Thank you for using the ChatGPT Twitch Bot! Your support is greatly appreciated. ☕ Buy me a coffee ☕
Cyclic is no longer supported for deployment. Please use Render for deploying this bot.