Skip to content

HinaDaughterMommyWife/twitch-translate-openai

Repository files navigation

Twitch chat translator with openai (only one user)


A program that translates Twitch chat messages from a specific user into another language.

It uses OpenAI for translation and tmi.js to connect to the Twitch API.

The program loads contextual information from the markdown file located at context/translate.md.

Environment Variables

API keys and configuration are managed through a .env file. The following variables are required:

# Twitch API credentials & other configurations

TWITCH_CLIENT_ID="your_client_id_here"
TWITCH_CLIENT_SECRET="your_client_secret_here"

TWITCH_BOT_USERNAME="your_bot_username_here"
TWITCH_LISTENING_CHANNEL="your_channel_here"
TWITCH_TARGET_USERNAME="target_username_here"

TWITCH_REDIRECT_URI="http://localhost:3000/callback"

# OpenAI API credentials

OPENAI_BASE_URL="your_base_API_url_here"
OPENAI_API_KEY="your_deepseek_api_key_here"

Requirements

  • Bun (recommended) or Node.js
  • PM2 (for VPS or self-hosting)

Installation

bun install

Usage

bun run index.ts

Simple health check:

# on twitch chat
ඞඞ

Self-Hosting or VPS

pm2 start ecosystem.config.js

Stop:

pm2 stop ecosystem.config.js

Logs

pm2 logs

To view only the bot's logs:

# Live monitoring (only messages from the target user and translated messages)
tail -f twitch-bot.log

# One-time output
cat twitch-bot.log

Made by Hina Lover 💕

About

A program that translates Twitch chat messages from a specific user into another language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published