對於開發人員來說, Twitchat公開了一個 API來接收事件並遠端控制某些功能。
閱讀其文檔。
/search
搜尋所有訊息/announce message
功能建立data/credentials/credentials.json
文件,填入值後設定以下內容:
{
"server_port" : 3018 ,
"admin_ids" : [ " YOUR_TWITCH_USER_ID " ],
"csrf_key" : " " ,
"twitch_client_id" : " " ,
"twitch_client_secret" : " " ,
"twitch_redirect_uri" : " http://localhost:8080/oauth " ,
"twitch_scopes" : [
" chat:read+user:read:chat " ,
" chat:edit+user:write:chat " ,
" moderator:manage:announcements " ,
" moderator:manage:chat_messages " ,
" moderator:manage:shoutouts " ,
" whispers:read " ,
" user:manage:whispers " ,
" moderator:read:chatters " ,
" channel:read:redemptions " ,
" channel:manage:redemptions " ,
" channel:manage:polls " ,
" channel:manage:predictions " ,
" moderator:manage:chat_settings " ,
" channel:moderate " ,
" channel:manage:moderators " ,
" channel:manage:vips " ,
" channel:manage:raids " ,
" channel:manage:broadcast " ,
" channel:read:hype_train " ,
" channel:edit:commercial " ,
" channel:read:subscriptions " ,
" user:read:emotes " ,
" user:read:follows " ,
" moderator:read:followers " ,
" user:read:moderated_channels " ,
" user:read:blocked_users " ,
" user:manage:blocked_users " ,
" user:edit:broadcast " ,
" moderator:manage:banned_users " ,
" moderator:manage:automod " ,
" moderator:manage:shield_mode " ,
" moderator:manage:unban_requests " ,
" clips:edit " ,
" channel:read:ads " ,
" channel:manage:ads " ,
" moderator:manage:blocked_terms " ,
" moderator:manage:warnings " ,
" moderator:read:moderators " ,
" moderator:read:vips " ,
" moderator:read:suspicious_users " ,
" bits:read "
],
"spotify_client_id" : " " ,
"spotify_client_secret" : " " ,
"spotify_scopes" : " user-read-currently-playing user-modify-playback-state playlist-read-private playlist-modify-public playlist-modify-private " ,
"spotify_redirect_uri" : " http://localhost:8080/spotify/auth " ,
"patreon_client_id" : " " ,
"patreon_client_secret" : " " ,
"patreon_scopes" : " identity campaigns campaigns.members w:campaigns.webhook " ,
"patreon_redirect_uri" : " http://localhost:8080/patreon/auth " ,
"patreon_client_id_server" : " " ,
"patreon_client_secret_server" : " " ,
"patreon_redirect_uri_server" : " http://localhost:3018/api/patreon/serverauth " ,
"patreon_webhook_secret" : " " ,
"patreon_cipherKey" : " " , //64 chars
"tenor_secret" : " " ,
"youtube_key" : " path/to/key.json " ,
"youtube_scopes" : [ " https://www.googleapis.com/auth/youtube.readonly " , " https://www.googleapis.com/auth/youtube.force-ssl " ],
"google_key" : " path/to/key.json " ,
"paypal_client_id" : " " ,
"paypal_client_secret" : " " ,
"donors_remote_api_secret" : " " ,
"contact_mail" : " " ,
"discord_client_id" : " " ,
"discord_public_key" : " " ,
"discord_bot_token" : " " ,
"streamlabs_client_id" : " " ,
"streamlabs_client_secret" : " " ,
"streamlabs_redirect_uri" : " " ,
"streamelements_client_id" : " " ,
"streamelements_client_secret" : " " ,
"tipeee_client_id" : " " ,
"tipeee_client_secret" : " " ,
"tipeee_redirect_uri" : " http://localhost:8080/tipeee/auth " ,
"tiltify_client_id" : " " ,
"tiltify_client_secret" : " " ,
"tiltify_webhook_verify" : " " ,
"tiltify_webhook_id" : " " ,
"tiltify_redirect_uri" : " http://localhost:8080/tiltify/auth " ,
"tiltify_scopes" : " public webhooks:write " ,
"tiltify_api_path" : " https://v5api.tiltify.com "
}
建立一個 twitch 應用程式並填入client_id
和client_secret
值。
在csrf_key
欄位中寫入您想要的任何內容,它將用於保護 twitch 身份驗證免受 CSRF 攻擊。
將 twitch 應用程式的重定向 URI 配置為:
http://localhost:8080/oauth
(如果在線部署,請適應正確的連接埠和網域)
將相同的值設定為credentials.json
檔案的redirect_uri
屬性。
您也可以建立一個Spotify應用程式並填寫spotify的spotify_client_id
和spotify_client_secret
預設情況下,伺服器偵聽連接埠 3018,您可以在credentials.json
和src_front/utils/Config.ts
上變更它。
該項目已使用 VSCode 進行編碼。
推薦安裝這些插件:
Vue 插件:https://marketplace.visualstudio.com/items?itemName=Vue.volar
I18n-ally 外掛:https://marketplace.visualstudio.com/items?itemName=lokalise.i18n-ally
npm install
npm run dev
npm run build
node server/boostrap.js
以下所有操作必須在 GIT 專案的單獨資料夾中完成。
編譯專案並將server
資料夾的內容推送到伺服器根目錄。
在此文件旁邊,建立一個public
並將本機dist
資料夾的內容推送到其中。
也要將憑證credentials
夾加入到專案根目錄下較舊的data
中。
建立一個env.conf
文件,在裡面寫入prod
,並將其推送到專案的根目錄下。
安裝所有生產依賴項並運行伺服器。
這是預期的文件結構:
─ 根
├─ 節點模組/
├─ 公開/
├─ 實用程式/
├─ 資料/
├─ 憑證/
├─ 控制器/
├─ bootstrap.js
├─ env.conf
只需在i18n
資料夾下建立一個新資料夾,其中包含該語言的 ISO 639-1 代碼。
閱讀下一節以了解如何翻譯標籤
為了使本地化盡可能簡單,我們創建了一個專用介面,列出了所有可用的類別和標籤,並可以編輯。
此介面上的任何更新都會觸發編譯文件的重建以及在同一瀏覽器上開啟的任何Twitchat頁面上的更新。
此介面僅供管理員訪問,可在此處找到:
本地主機:8080/標籤
若要取得管理員權限,您必須在credentials.json
檔案中的admin_ids
陣列下設定您的 twitch 使用者 ID。
如果需要新增標籤,則必須編輯 JSON 來源。
所有標籤檔案都可以在i18n
資料夾下找到。
它們按語言然後按部分劃分。
任何新的文件或資料夾結構都可以添加到其中。
這些都在建置過程中合併到static/labels.json
。
檔案可以具有任何名稱,但其中的所有標籤必須位於單一屬性下,該屬性將成為使用該標籤的基本路徑。屬性名稱通常與檔案名稱相同。
例子:
─ en
├─ global.json
├─ home.json/
├─ triggers.json/
global.json
範例:
{
"global" :{
"hello" : " World "
}
}
home.json
範例:
{
"home" :{
"lorem" : " ipsum dolor sit amet "
}
}
這將輸出這個 JSON 檔:
{
"en" :{
"global" :{
"hello" : " World "
},
"hello" :{
"lorem" : " ipsum dolor sit amet "
}
}
}
運行以下命令:
npm run streamdeck_package
編譯後的插件將位於streamdeck_plugin/fr. Twitchat .streamDeckPlugin
。