Save Quotes to CSV 腳本是一個 Streamlabs Chatbot 擴展程式,允許使用者將聊天室中的經典名言保存到 CSV 檔案中,並自動建立 Twitch 剪輯。此腳本提供可自訂的訊息,支援多個動態字串替換,並與 Twitch 的 Helix API 整合以實現自動剪輯功能。
- 名言管理:將名言儲存到 CSV 檔案,包含時間戳記、使用者名稱和自動產生的 Twitch 剪輯 URL。
- Twitch 剪輯整合:從保存的名言自動建立 Twitch 剪輯,具備以下特點:
- 剪輯標題設定為名言文本(支援 Unicode)
- 可配置的時長(5-60 秒)
- 自動將剪輯 URL 新增到 CSV 記錄
- 動態主播 ID:自動從 Twitch API 獲取主播 ID(無需手動設定)。
- 可自訂訊息:定義儲存名言後顯示的訊息,支援多個預留位置:
{quote}:保存的名言文本{date}:目前日期,格式為YYYY/MM/DD{streamer_name}:主播的顯示名稱{clip_url}:建立的 Twitch 剪輯 URL
- 靈活的設定:
- 自訂用於觸發保存名言功能的指令名稱
- 啟用/停用 Twitch 剪輯建立功能
- 向後相容性:自動將舊版 CSV 檔案(3 欄)升級為新格式(4 欄,包含剪輯 URL)。
- SaveQuotes_StreamlabsSystem.py:處理名言保存、Twitch 剪輯建立和設定管理的主要腳本。
- UI_Config.json:Streamlabs Chatbot 的設定檔案,定義所有可自訂的設定,包括 Twitch API 認證資訊。
- Settings/save_quotes_settings.json:儲存使用者設定,包括 CSV 路徑、指令名稱、自訂訊息和 Twitch 認證資訊。
- LICENSE:專案的授權資訊。
- README.md:英文及繁體中文文件。
- 將此儲存庫下載為
.zip檔案。 - 開啟 Streamlabs Chatbot,前往 Scripts 分頁。
- 點擊 Import 按鈕並選擇下載的
.zip檔案。 - 腳本將自動匯入並可開始使用。
- 設定您的 Twitch API 認證資訊(詳見下方設定章節)。
- 開啟 Streamlabs Chatbot,前往 Scripts 分頁。
- 選擇 Save Quotes to CSV 腳本。
- 設定下列項目:
- Path to CSV File:指定保存名言的檔案路徑(例如:
C:/quotes.csv)。 - Command Name:設定觸發保存名言功能的指令名稱(預設值:
!名言)。 - Custom Message:定義儲存名言後顯示的訊息(詳見下方預留位置說明)。
- Path to CSV File:指定保存名言的檔案路徑(例如:
-
若要啟用自動 Twitch 剪輯建立功能,您需要:
- Access Token:您的 Twitch Access token,包含 clips:edit 權限
- Client ID:您的 Twitch 應用程式 Client ID
-
取得認證資訊的步驟:
- 點擊設定中的 "Get Client ID & OAuth Token" 按鈕,該按鈕將開啟 Twitch Token Generator
- 按 Twitch Token Generator 的指示取得您的認證資訊,您只需要 clips:edit 權限
- 將 OAuth Token 和 Client ID 貼到設定面板的相應欄位中
-
額外的 Twitch 設定:
- Enable Twitch Clip Creation:勾選此方塊以在保存名言時自動建立剪輯
- Clip Duration:設定建立的剪輯時長(5-60 秒,預設值:30 秒)
- 在聊天室中,使用設定的指令(預設值:
!名言),後面跟上要保存的名言文本。- 範例:
!名言 這是一個值得紀念的時刻!
- 範例:
- 腳本將會:
- 從訊息中提取名言文本
- 自動建立 Twitch 剪輯(如果已啟用),剪輯標題為名言內容
- 將名言及剪輯 URL 保存到 CSV 檔案
- 在聊天室中顯示自訂訊息,並替換所有預留位置
CSV 檔案包含以下欄位:
- Timestamp:名言被保存的日期和時間(格式:
YYYY/MM/DD HH:MM:SS)。 - Username:觸發該指令的使用者名稱。
- Quote:保存的名言文本。
- Clip:自動建立的 Twitch 剪輯 URL(如果停用剪輯建立功能,此欄位為空)。
若您有舊版 CSV 檔案採用舊格式(3 欄:Timestamp、Username、Quote),腳本將在首次使用時自動將其升級為新格式(4 欄,新增 "Clip" 欄位),且不會影響現有資料。
自訂訊息支援下列預留位置:
{quote}:保存的名言文本。{date}:目前日期,格式為YYYY/MM/DD。{streamer_name}:主播的顯示名稱(從 Twitch 取得)。{clip_url}:建立的 Twitch 剪輯 URL(如果停用剪輯建立功能,此欄位為空)。
"{quote}" - {streamer_name} {date}
新的名言已保存!{quote} - {streamer_name} - 剪輯連結:{clip_url}
{streamer_name} 說:{quote} ({date}) 📽️ {clip_url}
剪輯標題自動支援 Unicode 字元。若您的名言包含特殊字元或非拉丁字母,建立 Twitch 剪輯時將正確編碼這些字元。
設定剪輯時長範圍為 5 至 60 秒:
- 最少:5 秒
- 最多:60 秒
- 預設值:30 秒
若輸入無效的數值,腳本將自動將其調整在此範圍內。
- 確保 CSV 檔案路徑有效且目錄可寫入。
- 查看 Streamlabs Chatbot 的日誌,檢查是否有與此腳本相關的錯誤訊息。
- 401 Unauthorized(未授權):驗證您的 OAuth Token 和 Client ID 是否正確且未過期。
- 400 Bad Request(不良請求):檢查名言文本是否為空,以及剪輯時長是否在 5-60 秒範圍內。
- 剪輯未建立:確保您擁有有效的 Twitch 主播認證資訊,且該頻道符合建立剪輯的條件。
- 舊版 CSV 格式無法識別:腳本會自動在首次使用時偵測並升級舊版 3 欄 CSV 檔案。
- 找不到檔案:仔細檢查設定中的 CSV 檔案路徑。使用絕對路徑或相對於 Streamlabs Chatbot 安裝位置的路徑。
- 儲存設定並重新整理腳本:前往 Scripts 分頁,關閉再開啟腳本,或重新啟動 Streamlabs Chatbot。
如有問題或功能需求,請查看儲存庫的問題追蹤器或聯絡開發者。
The Save Quotes to CSV script is a Streamlabs Chatbot extension that allows users to save memorable quotes from chat into a CSV file with automatic Twitch clip creation. The script provides customizable messages with dynamic string replacements and integrates with Twitch's Helix API for automatic clip functionality.
- Quote Management: Save quotes to a CSV file with timestamps, usernames, and automatic Twitch clip URLs.
- Twitch Clip Integration: Automatically create Twitch clips from saved quotes with:
- Clip title set to the quote text (with Unicode support)
- Configurable duration (5-60 seconds)
- Automatic clip URL appended to CSV records
- Dynamic Broadcaster ID: Automatically fetches broadcaster ID from Twitch API (no manual configuration needed).
- Customizable Messages: Define messages displayed after saving a quote with multiple placeholders:
{quote}: The text of the saved quote{date}: The current date inYYYY/MM/DDformat{streamer_name}: The streamer's display name{clip_url}: The URL to the created Twitch clip
- Flexible Settings:
- Customize the command name used to trigger the quote-saving functionality
- Enable/disable Twitch clip creation
- Backward Compatibility: Automatically upgrades legacy CSV files (3 columns) to the new format (4 columns with Clip URLs).
- SaveQuotes_StreamlabsSystem.py: The main script that handles quote saving, Twitch clip creation, and settings management.
- UI_Config.json: Configuration file for the Streamlabs Chatbot UI, defining all customizable settings including Twitch API credentials.
- Settings/save_quotes_settings.json: Stores user settings including CSV path, command name, custom message, and Twitch credentials.
- LICENSE: License information for the project.
- README.md: Documentation file.
- Download the repository as a
.zipfile. - Open Streamlabs Chatbot and navigate to the Scripts tab.
- Click on the Import button and select the downloaded
.zipfile. - The script will be automatically imported and ready to use.
- Configure your Twitch API credentials (see Configuration section below).
- Open Streamlabs Chatbot and navigate to the Scripts tab.
- Select the Save Quotes to CSV script.
- Configure the following settings:
- Path to CSV File: Specify the file path where quotes will be saved (e.g.,
C:/quotes.csv). - Command Name: Set the command name to trigger the quote-saving functionality (default:
!名言). - Custom Message: Define the message to display after saving a quote (see placeholders below).
- Path to CSV File: Specify the file path where quotes will be saved (e.g.,
-
To enable automatic Twitch clip creation, you need:
- Access Token: Your Twitch Access token with clips:edit permission
- Client ID: Your Twitch application Client ID
-
Getting Credentials:
- Click the "Get Client ID & OAuth Token" button in the settings, which opens Twitch Token Generator
- Follow Twitch Token Generator's instructions to obtain your credentials, you only need clips:edit permission
- Paste both the OAuth Token and Client ID into their respective fields in the settings panel
-
Additional Twitch Settings:
- Enable Twitch Clip Creation: Check this box to automatically create clips when quotes are saved
- Clip Duration: Set the duration of created clips (5-60 seconds, default: 30 seconds)
- In the chat, use the configured command (default:
!名言) followed by the quote text to save a quote.- Example:
!名言 This is a memorable moment!
- Example:
- The script will:
- Extract the quote text from the message
- Automatically create a Twitch clip (if enabled) with the quote as the title
- Save the quote to the CSV file with the clip URL
- Display the custom message in the chat with all placeholders substituted
The CSV file will contain the following columns:
- Timestamp: The date and time when the quote was saved (format:
YYYY/MM/DD HH:MM:SS). - Username: The username of the person who triggered the command.
- Quote: The text of the saved quote.
- Clip: The URL to the automatically created Twitch clip (empty if clip creation is disabled).
If you have an existing CSV file with the legacy 3-column format (Timestamp, Username, Quote), the script will automatically upgrade it to the new 4-column format on first use, adding a "Clip" column without affecting your existing data.
The custom message supports the following placeholders:
{quote}: The text of the saved quote.{date}: The current date inYYYY/MM/DDformat.{streamer_name}: The streamer's display name (fetched from Twitch).{clip_url}: The URL to the created Twitch clip (empty if clip creation is disabled).
"{quote}" - {streamer_name} {date}
New quote saved! {quote} - {streamer_name} - Clip link: {clip_url}
{streamer_name} said: {quote} ({date}) 📽️ {clip_url}
Clip titles automatically support Unicode characters. If your quote contains special characters or non-Latin scripts, they will be properly encoded when creating the Twitch clip.
Configure clip duration between 5 and 60 seconds:
- Minimum: 5 seconds
- Maximum: 60 seconds
- Default: 30 seconds
The script will automatically clamp the value to this range if an invalid value is entered.
- Ensure the CSV file path is valid and the directory is writable.
- Check the Streamlabs Chatbot logs for any errors related to the script.
- 401 Unauthorized: Verify that your OAuth Token and Client ID are correct and haven't expired.
- 400 Bad Request: Check that the quote text is not empty and the clip duration is between 5-60 seconds.
- Clip not created: Ensure you have valid Twitch broadcaster credentials and that the channel is eligible for clip creation.
- Old CSV format not recognized: The script automatically detects and upgrades legacy 3-column CSV files on first use.
- File not found: Double-check the CSV file path in the settings. Use absolute paths or paths relative to your Streamlabs Chatbot installation.
- Save settings and refresh the script: Go to the Scripts tab, toggle the script off/on, or restart Streamlabs Chatbot.
If you have any issues or feature requests, please check the repository's issue tracker or contact the developer.