对于开发人员来说, 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
。