MemeZuki Studio
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # YT訂閱數通知Discord機器人 ![GitHub release (latest by date)](https://img.shields.io/github/v/release/Yue030/discord-yt-sub-count) ![GitHub last commit](https://img.shields.io/github/last-commit/yue030/discord-yt-sub-count) ![GitHub pull requests](https://img.shields.io/github/issues-pr/yue030/discord-yt-sub-count) ![GitHub issues](https://img.shields.io/github/issues-raw/yue030/discord-yt-sub-count) ![GitHub](https://img.shields.io/github/license/Yue030/discord-yt-sub-count) [![hackmd-github-sync-badge](https://hackmd.io/kLes1yobSLyIWwWQo2JH5A/badge)](https://hackmd.io/kLes1yobSLyIWwWQo2JH5A) ## 演示預覽 ### 查看訂閱數,及設定通知頻道 ![](https://i.imgur.com/8ajsTyd.gif) ### 訂閱數通知 當Call Youtube Data API v3 後訂閱數有更新時,會在通知頻道顯示以下訊息 ![](https://i.imgur.com/vi4jxvt.png) ## 目錄 - [YT訂閱數通知Discord機器人](#yt訂閱數通知discord機器人) - [演示預覽](#演示預覽) - [查看訂閱數,及設定通知頻道](#查看訂閱數及設定通知頻道) - [訂閱數通知](#訂閱數通知) - [目錄](#目錄) - [安裝](#安裝) - [安裝方法](#安裝方法) - [配置檔案](#配置檔案) - [獲取機器人token](#獲取機器人token) - [獲取Google API Key](#獲取google-api-key) - [Prefix 自訂義](#prefix-自訂義) - [欲查詢頻道設置](#欲查詢頻道設置) - [邀請機器人](#邀請機器人) - [啟動機器人](#啟動機器人) - [LICENSE: GNU General Public License v3.0](#license-gnu-general-public-license-v30) ## 安裝 Node.js v16.11 UP - https://nodejs.org/en/ Git - https://git-scm.com/downloads ### 安裝方法 ``` git init git clone https://github.com/Yue030/discord-yt-sub-count.git ``` OR 點選 Code -> Download ZIP ![](https://i.imgur.com/lfk5OjE.png) ### 配置檔案 config.json ```json { "token": "", "prefix": "", "google-api": "https://www.googleapis.com/youtube/v3/channels?part=statistics&part=snippet&id={id}&key={key}", "google-api-key": "", "yt-channel-id": "" } ``` **token** > Discord機器人token **prefix** > 指令前綴 **google-api** > Youtube Data API v3 網址 (建議不要去動) > > {id} 將會在執行的時候,自動帶入成 yt-channel-id 屬性 > > {key} 將會在執行的時候,自動帶入成 google-api-key 屬性 **google-api-key** > Google API 金鑰 **yt-channel-id** > 欲查詢訂閱數的頻道 ### 獲取機器人token 請開啟 [Discord Developer Portal](https://discord.com/developers/) 並點選右上角的New Application ![](https://i.imgur.com/aflg7Gq.png) 輸入Application名稱 (不影響機器人名稱),並點選Create ![](https://i.imgur.com/vMxFdnu.png) 點選左側Bot ![](https://i.imgur.com/VCmWWvD.png) 並按下Add Bot ![](https://i.imgur.com/bosyQQW.png) 進入到此頁面,你可以在這個時候更改機器人的頭貼及名稱 ![](https://i.imgur.com/90DBNcL.png) 點選 Token 區塊的 Copy ![](https://i.imgur.com/RVpcY2D.png) 將複製下來的token在config.json的token屬性的""中貼上 ### 獲取Google API Key 到 [Google Cloud Platform](https://console.developers.google.com/?hl=zh-tw) 建立一個專案 ![](https://i.imgur.com/XWRxleN.png) 建立過後,打開左邊的選單 找到API和服務,並點選憑證 ![](https://i.imgur.com/Hop3nLX.png) 點選上方 **建立憑證** - **API金鑰** ![](https://i.imgur.com/LG2Nucy.png) 將獲取到的API金鑰複製起來 ![](https://i.imgur.com/mk68VRQ.jpg) 將複製下來的金鑰在config.json的google-api-key屬性的""中貼上 #### Prefix 自訂義 更改config.json的prefix屬性 若設置為 "!" 輸入指令時必須輸入 ``` !count !set #(頻道名稱) ``` 才會有效果 若設置為 "M$" 則輸入指令格式為輸入 ``` M$count M$set #(頻道名稱) ``` ### 欲查詢頻道設置 請打開您這個DD仔推的Vtuber的頻道 並在網址處複製頻道ID > 若顯示的是頻道名稱 > > 請點一部影片,再點頭像,才可以看到ID ![](https://i.imgur.com/0foqTwL.png) 將複製下來的頻道ID在config.json的yt-channel-id屬性的""中貼上 由於目前設定關係,不好意思 **我們只支援單推** 若您堅持DD,請另外設置機器人,並重複上述所有操作 > 貼心提醒: Google API Key 不可重複使用 ### 邀請機器人 回到 [Discord Developer Portal](https://discord.com/developers/) 並點選剛剛創建的Application 點擊OAuth2 ![](https://i.imgur.com/r9GoNPz.png) 到OAuth2 URL Generator區塊,並點選bot選項 ![](https://i.imgur.com/AZ40dNA.png) 並在下方的BOT PERMISSIONS開啟Adminstrator權限 ![](https://i.imgur.com/Vlc6Nxg.png) 複製下方連結 ![](https://i.imgur.com/baEM9hQ.png) 並在瀏覽器貼上此連結,選取伺服器後,按下繼續 ![](https://i.imgur.com/Vijk6fa.png) 按下授權 ![](https://i.imgur.com/hmIXsMV.png) 機器人將會進到指定的群組 ## 啟動機器人 開啟命令提示字元(cmd)並切換到機器人檔案的資料夾 輸入 ``` npm install npm start ``` 即可執行 ## LICENSE: [GNU General Public License v3.0](https://opensource.org/licenses/GPL-3.0)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully