Topluluk Tarafından Desteklenen Ücretsiz Yapay Zeka Araçları, TTS ve API'ler için Twitch Yayıncıları
Topluluk Tarafından Desteklenen Ücretsiz Yapay Zeka Araçları, TTS ve API'ler için Twitch Yayıncıları

Streamer.bot'ta Özel Bir Betik ile Yapay Zeka Görselleri Nasıl Oluşturulur

Streamer.bot içinde doğrudan Twitch yayınınız için ücretsiz yapay zeka görselleri nasıl üretilir öğrenin; özel bir Execute Code betiği ekleyerek üçüncü taraf ara katman yazılımı gerekmez.
Bu sayfa, kolaylığınız için yüksek motivasyona sahip yapay zeka stajyerlerimiz tarafından İngilizceden çevrilmiştir. Hâlâ öğreniyorlar, bu yüzden birkaç hata olabilir. En doğru bilgi için lütfen İngilizce sürüme bakın.
Ev Nasıl Yapılır Rehberleri Streamer.bot'ta Özel Bir Betik ile Yapay Zeka Görselleri Nasıl Oluşturulur

PotatoHotDog, Streamer.bot'tan doğrudan çağırabileceğiniz, üçüncü taraf herhangi bir ara yazılıma ihtiyaç duymadan çalışan ücretsiz bir Yapay Zeka Görüntüleri Üretim API'si sunar. Bu rehber, bir metin isteminden üretilen bir yapay zeka görselini diske kaydeden küçük bir özel C# betiğini, Streamer.bot'in Execute Code alt eylemine nasıl ekleyeceğinizi gösterir.

Bu betik yalnızca PotatoHotDog API anahtarınıza ve oluşturulmasını istediğiniz resmi betimleyen bir isteme ihtiyaç duyar ve indirilen resmi Streamer.bot kurulum dizininizdeki özel bir klasöre kaydeder.

Bir API anahtarı hazırlayın

Zaten bir API anahtarınız yoksa, panelinizden bir API anahtarı oluşturun ve hazırda bulundurun; bir sonraki adımda buna ihtiyacınız olacak.

API Anahtarlarına Git PotatoHotDog kontrol panelinde bir API anahtarı oluşturun

Önkoşul Argümanları

Bir yapay zeka görseli oluşturmak için, Execute Code alt adımı çalışmadan önce Streamer.bot içinde iki argümanın belirtilmesi gerekir. Başka bir deyişle, bu iki şey belirtilmelidir:

  • Bir API anahtarı.
  • O görüntüyü oluşturmak için talimatları tanımlayan yönergeler.

Bunlar, aşağıdaki Streamer.bot argümanlarına karşılık gelirler.

  • potatoKey
  • potatoInstructions

İşleminizde argümanları belirtmek için Alt Eylemler'e sağ tıklayın, ardından Ekle, Çekirdek, Argümanlar seçeneklerini seçin ve son olarak Argümanı Ayarla.

Streamer.bot'ta bir Set Argument alt eylemi ekle

Streamer.bot'ta Bir Kod Çalıştırma Eylemi Ekleme

Streamer.bot'u açın ve Eylemler sekmesine gidin. Yeni bir eylem oluşturun veya var olanı açın ve sonradan tanıyacağınız bir ad verin, örneğin "PotatoHotDog AI Image".

Seçili eyleminizle, Sub Actions altında Add'e tıklayın, sonra Core'u seçin ve ardından Execute C# Code'u seçin. Bu, Streamer.bot'ın derlediği ve anında çalıştırdığı ham C# kodunu yapıştırabileceğiniz bir alt eylem ekler.

Streamer.bot'ta C# kodu çalıştırma alt eylemi ekle

Aşağıdaki betiği kod düzenleyiciye yapıştırın. Bu betik, potatoKey ve potatoInstructions argümanlarını okur, görüntüyü oluşturmak ve URL'sini almak için bizim Generate AI Image API'mizi çağırır ve ardından elde edilen görüntüyü Streamer.bot kurulum dizininizde bulunan temp_potatohotdog_images adlı klasöre indirir.

using System; using System.IO; using System.Net.Http; using Newtonsoft.Json.Linq; public class CPHInline { // Tracks the version of this script for troubleshooting and support. private const string VERSION = "1.0.0"; // Base URL for the endpoint that generates an AI image. private const string BASE_URL_GENERATE = "https://api-generate-image-v1.potatohotdog.com/"; // Tracks the next numbered log argument. private int logIndex = 0; // Reuses one HTTP client for all API requests. private static readonly HttpClient httpClient = new HttpClient { Timeout = TimeSpan.FromSeconds(30) }; // Adds a log message as a numbered action argument. private void Log(string message) { // Stores the message under a numbered key. CPH.SetArgument($"potatoLog{logIndex}", message); // Advances the log index for the next message. logIndex++; // Keeps the total log count in sync. CPH.SetArgument("potatoLogCount", logIndex); } // Ensures a required action argument exists and is not empty. private bool RequireArgument(string name, out string value) { // Fails when the argument is missing or blank. if (!CPH.TryGetArg(name, out value) || string.IsNullOrWhiteSpace(value)) { value = ""; return false; } return true; } // URL-encodes a value so it can safely be used in a query string. private string EncodeUrlValue(string value) { // Escapes reserved characters for safe use in a URL. return Uri.EscapeDataString(value); } // Performs an HTTP GET request and returns the response body. private string HttpGet(string url) { try { Log($"GET {url}"); // Sends the HTTP request synchronously. HttpResponseMessage response = httpClient.GetAsync(url).GetAwaiter().GetResult(); // Reads the complete response body. string responseBody = response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); Log($"HTTP status: {(int)response.StatusCode} {response.ReasonPhrase}"); // Stops when the server returns an unsuccessful status code. if (!response.IsSuccessStatusCode) { Log($"Error: HTTP request failed with status {(int)response.StatusCode} {response.ReasonPhrase}."); // Logs the server error response when available. if (!string.IsNullOrWhiteSpace(responseBody)) { Log($"Error response: {responseBody}"); } return null; } Log($"Received {responseBody.Length} characters."); return responseBody; } catch (Exception exception) { // Logs network, timeout, and other HTTP-related exceptions. Log($"Error: HTTP request failed: {exception.Message}"); return null; } } // Downloads a file from a URL and saves it to disk. private bool DownloadFile(string url, string destinationPath) { try { Log($"Downloading image from \"{url}\"."); Log($"Saving image to \"{destinationPath}\"."); // Sends the image download request. HttpResponseMessage response = httpClient.GetAsync(url).GetAwaiter().GetResult(); Log($"Image download HTTP status: {(int)response.StatusCode} {response.ReasonPhrase}"); // Reads the complete image response into memory. byte[] fileData = response.Content.ReadAsByteArrayAsync().GetAwaiter().GetResult(); // Stops when the image server returns an unsuccessful status. if (!response.IsSuccessStatusCode) { Log($"Error: Image download failed with status {(int)response.StatusCode} {response.ReasonPhrase}."); return false; } // Rejects an empty image response. if (fileData == null || fileData.Length == 0) { Log("Error: The downloaded image file is empty."); return false; } // Writes the downloaded image bytes to the destination file. File.WriteAllBytes(destinationPath, fileData); Log($"Downloaded {fileData.Length} image bytes."); // Confirms that the image file now exists on disk. if (!File.Exists(destinationPath)) { Log("Error: The image download completed, but the file does not exist on disk."); return false; } // Reports the final file size from disk. FileInfo fileInfo = new FileInfo(destinationPath); Log($"Image file saved successfully. File size: {fileInfo.Length} bytes."); return true; } catch (Exception exception) { // Logs download, filesystem, and permission errors. Log($"Error: Could not download the image file: {exception.Message}"); return false; } } // Extracts a required string value from a JSON response. private bool TryGetJsonString(string json, string propertyName, out string value) { value = ""; try { // Parses the response body as a JSON object. JObject jsonObject = JObject.Parse(json); // Retrieves the requested JSON property. JToken property = jsonObject[propertyName]; if (property == null) { Log($"Error: JSON response does not contain \"{propertyName}\"."); return false; } value = property.ToString(); // Rejects empty JSON string values. if (string.IsNullOrWhiteSpace(value)) { Log($"Error: JSON property \"{propertyName}\" is empty."); value = ""; return false; } return true; } catch (Exception exception) { // Logs malformed JSON and property conversion errors. Log($"Error: Could not parse JSON property \"{propertyName}\": {exception.Message}"); return false; } } // Creates and returns the dedicated PotatoImage folder. private string GetImageFolder() { // Uses Streamer.bot's application directory instead of the process working directory. string streamerBotFolder = AppDomain.CurrentDomain.BaseDirectory; // Places generated image files inside a dedicated subfolder. string imageFolder = Path.Combine(streamerBotFolder, "temp_potatohotdog_images"); Log($"Streamer.bot folder: \"{streamerBotFolder}\"."); Log($"Image folder: \"{imageFolder}\"."); // Creates the image folder if it does not already exist. if (!Directory.Exists(imageFolder)) { Log("Image folder does not exist. Creating it..."); Directory.CreateDirectory(imageFolder); Log("Image folder created."); } else { Log("Image folder already exists."); } return imageFolder; } // Runs the main PotatoHotdog AI image action. public bool Execute() { // Resets log numbering for this execution. logIndex = 0; CPH.SetArgument("potatoLogCount", 0); Log("Starting script..."); // Logs the script version so runs can be tracked over time. Log($"Version: {VERSION}"); // Retrieves the PotatoHotdog API key. if (!RequireArgument("potatoKey", out string potatoKey)) { Log("Error: potatoKey variable is missing. Please login to potatohotdog.com, generate an API key, create a set variable action and save the variable \"potatoKey\" with your key."); return false; } // Retrieves the prompt instructions describing the image to generate. if (!RequireArgument("potatoInstructions", out string potatoInstructions)) { Log("Error: potatoInstructions variable is missing. Create a set variable action and save the variable \"potatoInstructions\" with a description of the image you want generated."); return false; } // Logs the non-secret input values. Log("potatoKey was provided."); Log($"potatoInstructions=\"{potatoInstructions}\""); // Builds the API URL used to generate the AI image. string generateUrl = BASE_URL_GENERATE + "?key=" + EncodeUrlValue(potatoKey) + "&instructions=" + EncodeUrlValue(potatoInstructions); // Requests generation of the AI image. string generateJson = HttpGet(generateUrl); if (generateJson == null) { Log("Error: Failed to generate the AI image."); return false; } Log($"Generate response: {generateJson}"); // Extracts the generated item's ID, reused below as the local filename. if (!TryGetJsonString(generateJson, "itemID", out string itemID)) { Log("Error: Could not retrieve itemID from the generate response."); return false; } Log($"itemID=\"{itemID}\""); // Logs the generation duration when present, purely for troubleshooting. if (TryGetJsonString(generateJson, "duration", out string duration)) { Log($"duration={duration} second(s)"); } // Extracts the generated image URL from the response. if (!TryGetJsonString(generateJson, "imageURL", out string imageURL)) { Log("Error: Could not retrieve imageURL from the generate response."); return false; } Log($"imageURL=\"{imageURL}\""); string imageFolder; try { // Resolves and creates the dedicated PotatoImage directory. imageFolder = GetImageFolder(); } catch (Exception exception) { Log($"Error: Could not create or access the image folder: {exception.Message}"); return false; } // Reuses the item's own ID as the local filename instead of minting a new one. string imageFileName = $"{itemID}.png"; // Combines the image folder and unique filename. string imageFilePath = Path.Combine(imageFolder, imageFileName); Log($"Generated image filename: \"{imageFileName}\"."); Log($"Local image path: \"{imageFilePath}\"."); // Downloads the generated image file to the PotatoImage folder. if (!DownloadFile(imageURL, imageFilePath)) { Log("Error: Failed to download the generated AI image."); return false; } // Stores the remote image URL as a final action argument. CPH.SetArgument("potatoGeneratedImageURL", imageURL); // Stores the absolute local file path as a final action argument. CPH.SetArgument("potatoGeneratedImageFile", imageFilePath); Log($"potatoGeneratedImageURL=\"{imageURL}\""); Log($"potatoGeneratedImageFile=\"{imageFilePath}\""); Log("Finished."); return true; } }

Komut dosyasını yapıştırdıktan sonra, Referansları Bul ve Derle adımlarına tıklamayı unutmayın ve derlemenin başarıyla tamamlandığından emin olun. Eylemi kaydedin, ardından manuel olarak tetikleyin veya bir komuta ya da kanal puanı ödülüne bağlayarak resmin doğru şekilde üretildiğini test edin.

Betiği yapıştırın ve Streamer.bot'ta derleyin

İndirilen resmi inceleyin

İşlem çalıştıktan sonra, her şeyin beklediğiniz gibi çalıştığını doğrulamak için İşlem Geçmişi üzerinden İşlem Değişkenlerini inceleyebilirsiniz.

Orada, üretilen görüntünün diske kaydedildiği yerel yolu bulacaksınız; bu yol, Streamer.bot kurulum dizininizdeki temp_potatohotdog_images klasörü içindedir.

İşlem geçmişinde üretilen görüntü değişkenlerini inceleyin

İndirilen resmi doğrudan görmek için o klasörü açın.

Eylem değişkenlerini Streamer.bot'taki Eylem Geçmişi aracılığıyla inceleyin

Sorun Giderme

Betik beklediğiniz gibi çalışmazsa, sorunu gidermenin en iyi yolu eylem günlüklerini kontrol etmektir.

Bunu Eylem değişkenlerini Eylem Geçmişi üzerinden inceleyerek yapabilirsiniz.

Eylem değişkenlerini Streamer.bot'taki Eylem Geçmişi aracılığıyla inceleyin

Bu rehber ilk kez 2026-07-19 tarihinde yayımlandı ve en son 2026-07-19 tarihinde güncellendi.

Diğer Benzer Rehberler

İşte işinize yarayabilecek bazı diğer nasıl yapılır kılavuzları.

Streamer.bot'u bir AI'ye nasıl bağlarsınız?
Streamer.bot'u bir AI'ye nasıl bağlarsınız?
Streamer.bot'ta Twitch yayını için ücretsiz AI (LLM) yanıtlarını Fetch URL alt eylemi kullanarak ve PotatoHotDog Generate AI Response API ile nasıl üreteceğinizi öğrenin; özel bir betik gerekmez.
Kılavuzu Oku
Dynamic Browser Sources ile Streamer.bot'ta Ücretsiz TTS Sesi Nasıl Oynatılır
Dynamic Browser Sources ile Streamer.bot'ta Ücretsiz TTS Sesi Nasıl Oynatılır
Streamer.bot kullanarak Twitch yayını için ücretsiz yapay zeka TTS (Text-to-Speech) seslerini nasıl çalacağınızı Dinamik Tarayıcı Kaynağı kullanarak ve basit bir Fetch URL webhook isteğiyle öğrenin; özel bir betik gerekmez.
Kılavuzu Oku
Streamer.bot'ta Özel Bir Betik ile Ücretsiz TTS Sesi Nasıl Oynatılır
Streamer.bot'ta Özel Bir Betik ile Ücretsiz TTS Sesi Nasıl Oynatılır
Streamer.bot içinde, özel bir Execute Code betiği ekleyerek Speaker.bot'a gerek kalmadan Twitch yayını için ücretsiz AI TTS (Text-to-Speech) sesini nasıl çalacağınızı öğrenin.
Kılavuzu Oku