Try   HackMD

綠界斗內訊息同步到YouTube聊天室的無用垃圾小程式 - 使用手冊

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

最近..我開發了一個無用的垃圾小程式,是將觀眾在綠界(ECPay)斗內的訊息同步到YouTube聊天室,簡單來說是有點意義不明的用途,畢竟綠界本身的實況主收款功能就有支援斗內特效的提示,不過綠界的斗內特效跟我寫的這個垃圾小程式是可以同時進行的,就這樣 (。•́︿•̀。)

◆ 目錄

■ 影片示意

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

關於影片中的綠界支付過程我使用綠界官網提供的測試用卡號,所以不用擔心。

■ 事前準備

  • 下載我提供的資源包 (Google雲端硬碟下載) (解壓縮密碼:Vtuber_ECPayMsg)
  • 一組有通過實況主收款審查的綠界帳戶
  • 一組有經營YouTube頻道的Google帳戶

警告:本次資源包的檔案內容,有可能會被部分的防毒軟體誤報,如有擔心安全疑慮等問題,個人建議先找專人另外測試處理,或是直接關閉本篇教學文章。

■ 基本設定

如果2~23的部分太過複雜的話,可以考慮以客製化委託為你協助(@Mirai_so_Sad),當然基本設定弄完以後就直接從「開始執行

1.首先解壓縮「Vtuber_ECPayMsg.7z」之後,找到「config.txt」並開啟編輯內容。

這邊的解壓縮需要安裝 7-Zip 軟體進行解壓縮。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

2.接著開啟瀏覽器軟體(如:Google Chrome、Microsoft Edge等)後,到以下網址登入綠界帳號之後,開始準備相關的設定。

https://www.ecpay.com.tw

3.首先選擇「收款工具」→「實況主收款」。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

4.在左側選擇「系統開發管理」→「系統界接設定」,並且分別複製「界接 HashKey」和「界接 HashIV」下方的代碼。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

5.回到「config.txt」分別貼在「ECPay_hash_key」和「ECPay_hash_iv」。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

6.接著開啟瀏覽器軟體(如:Google Chrome、Microsoft Edge等)後,到以下網址登入Google帳號之後,點擊在右上角的帳戶頭像,在「設定」左側選擇「進階設定」,並複製「頻道ID」。

https://www.youtube.com

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

7.回到「config.txt」把剛複製的「頻道ID」貼在「Admin_user_ids」內,這是設定哪些帳號可以使用具有「管理權限」的「聊天指令」。

如果想設定複數的管理權限帳號,則以["UCxxxxxxxxxxxxxx", "UCxxxxxxxxxxxxxx"]格式新增帳號,以此類推。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

8.開啟瀏覽器軟體(如:Google Chrome、Microsoft Edge等)後,到以下網址登入Google帳號之後,開始完成初次設定。

https://console.cloud.google.com

9.初次設定選擇你所在的「國家」及「勾選」同意。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

10.在上方的「搜尋框」輸入「YouTube Data API v3」。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

11.接著把「YouTube Data API v3」的功能「啟用」。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

12.在左側選擇「憑證」,然後按「建立憑證」,選擇「OAuth 用戶端 ID」。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

13.按下「設定同意畫面」,選擇「開始」。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

14.接著設定「應用程式名稱」、「使用者支援電子郵件」,按「下一步」。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

15.選擇「外部」後,按「下一步」。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

16.設定聯絡用的「電子郵件地址」後,按「下一步」。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

17.勾選「同意」後,按「建立」。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

18.接著按「建立OAUTH用戶端」,選擇「應用程式類型」為「電腦版應用程式」還有設定「名稱」後,按下「建立」。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

19.之後按下「下載JSON」,並重新命名為「client_secret.json」,保存在「Vtuber_ECPayMsg」資料夾中。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

20.在左側選擇「目標對象」,在「測試使用者」按下「ADD USERS」,新增自己常用於實況的「Email地址」後,按「儲存」。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

21.回到「config.txt」,開始分別設定「斗內門檻」、「感謝訊息」,還有「管理員用聊天指令」和「系統訊息」。

這邊說一下,總共可以設定7種「斗內門檻」的訊息,例如第一項15為觀眾斗內超過15元以上顯示「感謝 [$1] 的G級支持費[$2]元 「[$3]」」(以此類推),然後 [$1] 會顯示觀眾暱稱, [$2] 會顯示斗內金額, [$3] 會顯示斗內訊息。

例如「Mirai」在綠界斗內「250元」,訊息為「加油!祝你頻道早日收益化!」

→ 感謝 Mirai 的D級支持費250元 「加油!祝你頻道早日收益化!」

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

這邊則是設定管理員用「聊天指令」,建議別移除聊天指令開頭的半形驚嘆號「!」

在「System_message04」的{min_amount},和{template}為回傳設定的「金額門檻」和「自訂訊息」。

而自訂訊息可以使用 [$1] (顯示觀眾暱稱), [$2] (顯示斗內金額), [$3] (顯示斗內訊息)。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

─ 管理員能夠使用的預設聊天指令有兩種 ─

!限定活動 {金額} {模板}

例如:!限定活動 {400} {感謝 [$1] 以 [$2] 元購買拍立得抽抽樂。 「[$3] 」而自訂訊息可以使用 [$1] (顯示觀眾暱稱), [$2] (顯示斗內金額), [$3] (顯示斗內訊息),而且這個可以設定複數以上的指令

!清除所有限定活動

這是用來清除目前已設定的 !限定活動 的所有指令,當然如果你下播後結束也會清除。

22.開啟瀏覽器軟體(如:Google Chrome、Microsoft Edge等)後,到以下網址註冊帳號登入後,在Download那邊選擇下載並解壓縮ngrok.exe的程式到「Vtuber_ECPayMsg」資料夾內。

由於可能會被瀏覽器軟體本身的安全性阻擋下載,所以ngrok.exe程式會一併附在本資源包內。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

23.接著複製登入用的「金鑰代碼」,在「Vtuber_ECPayMsg」資料夾內執行「ngrok.exe」,並且將剛才網頁上複製的登入金鑰貼到ngrok.exe上後,按下鍵盤上的「Enter」等待執行完後關閉ngrok視窗。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

■ 開始執行

1.當你有開啟OBS直播軟體,並開始進行直播串流之後,在「Vtuber_ECPayMsg」資料夾內執行「Start.bat」並複製ngrok視窗內「Forwarding」右側紅色框選範圍的網址。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

初次執行時會跳出一個Google登入頁面,選擇你實況用的Google帳號後,選擇「繼續」之後,在看到「The authentication flow has completed. You may close this window.」文字之後可以關閉該網頁,並成功產生必要的「token.json」檔案。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

2.接著開啟瀏覽器軟體(如:Google Chrome、Microsoft Edge等)後,到以下網址登入綠界帳號之後,一樣選擇「收款工具」→「實況主收款」那邊,在「付款完成通知回傳網址」輸入剛才複製的網址+「/ecpay_notify」,例如:「https://xxxxxoooo.ngrok-free.app/ecpay_notify」,按下「儲存設定」即可完成。

https://www.ecpay.com.tw

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

最後,如果下播後想停止本程式的話,只要把目前開啟的程式視窗和ngrok的視窗都關閉就好了,下次想再次開台時,一樣從「開始執行」那邊開始操作就好了。