Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Streamer.bot Chat Auto-Translate

This project provides automatic chat translation for Streamer.bot, supporting multiple platforms (Twitch, Kick) and text-to-speech (TTS) integration.

Features

  • Auto-translate chat messages using Google Translate API
  • Platform-specific message sending (Twitch, Kick)
  • TTS support for translated messages
  • Ignore users and bots per platform
  • Customizable translation and TTS settings

Setup Instructions

Required Global Variables (set in Streamer.bot)

Variable Name Default Value Required? Description
translator_apikey None Yes Google Translate API key. Must be set for translation to work.
translator_target_lang en No Target language for translation. Defaults to English (en).
translator_default_tts "" No Default TTS alias for translated messages. If not set, TTS will be skipped unless a language-specific alias is configured.
translator_understood_langs None No Comma-separated list of languages you understand. If not set, only the target language is used.

Note: Changing any of the above global variables or any variables set in the code will require you to recompile the C# code in Streamer.bot for changes to take effect.

Ignored Users and Bots

ignoredUsers

The ignoredUsers array allows you to specify users to ignore for each platform. It is structured as an array of tuples: (sourceType, username). This means you can ignore the same username on different platforms independently.

Example:

private (sourceType, string)[] ignoredUsers = new[]{
	(sourceType.stTwitch, "fulltimeslob"),
	(sourceType.stTwitch, "c0unter_attack"),
	(sourceType.stKick, "somekickuser")
};

To ignore a user, add their username and platform to the array. If you want to ignore a user on both Twitch and Kick, add an entry for each platform.

ignoredBots

The ignoredBots array is a simple list of bot usernames that will be ignored on all platforms. Add any bot usernames you want to ignore to this array.

Example:

private string[] ignoredBots = { "streamelements", "nightbot" };

After making changes to these arrays, recompile the code in Streamer.bot for changes to take effect.

TTS Settings

translateSettings

The translateSettings array lets you specify custom TTS aliases for specific languages. It is an array of tuples: (language_code, tts_alias). When a message is translated and the detected language matches an entry, the corresponding TTS alias will be used for speech output.

Example:

private (string, string)[] translateSettings = new[] {
	("ja", "JapanesePreTrans"), // Use Japanese TTS for Japanese messages
	("es", "SpanishTTS")         // Use Spanish TTS for Spanish messages
};

If no match is found, the default TTS alias (set by translator_default_tts) will be used, if provided. If neither is set, TTS will be skipped.

After updating translateSettings, recompile the code in Streamer.bot for changes to take effect.

Logging and Debugging

This project uses Streamer.bot's logging functions to help you monitor and debug translation activity. The following logging methods are used:

  • CPH.LogDebug(...): Used for informational and debug messages, such as when a translation is requested, the detected language, and when the HttpClient is disposed.
  • CPH.LogError(...): Used for error messages, such as missing API keys, failed API requests, or invalid translation responses.

How to Filter Log Messages

All log messages related to this project are prefixed with [Translation API]. To quickly find relevant messages in the Streamer.bot log output:

  1. Open the log viewer in Streamer.bot.
  2. Use the search or filter feature to look for [Translation API].
  3. This will show only the messages generated by this translation script, making it easier to debug issues or monitor activity.

Note: Debug messages (CPH.LogDebug) may not appear unless your Streamer.bot logging settings are configured to show debug-level output. If you do not see these messages, check your logging configuration in Streamer.bot and enable debug logging if needed.

Examples of log messages:

[Translation API] Translation requested for: "Hello" by ArnieTW
[Translation API] Detected Language: ja
[Translation API] Invalid translation response - no translations found
[Translation API] API Key is not set. Please set the 'translator_apikey' global variable.

Shoutout

I am a small streamer and a shoutout would help a lot! Please visit and support: twitch.tv/ArnieTW

License

MIT

About

Script to translate message in your chat to specified languages, TTS setup, multi-alias TTS ( per language )

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages