/bot_269

Primary LanguagePythonGNU Affero General Public License v3.0AGPL-3.0

Bot_269 - 自由的Discord機器人

Copyright (C) 2022 CToID

This file is a part of bot_269

bot_269 is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

bot_269 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.

bot_269 has been archived, use id_bot instead

目錄

主要功能

(對我用白色主題,不然你想怎樣)

回覆指定的訊息內容

你可以設定特定的訊息內容讓269來回覆。 ./images/reply.gif

為指定的訊息內容加入回應

你也可以設定讓269對指定訊息加上回應。 ./images/react.gif

幫你決定要吃什麼

想不到要吃什麼嗎?269幫你決定。 ./images/eat.gif

今日運勢

想知道今天會不會過的順利嗎?269告訴你。 ./images/luck.gif

Twitch開台通知

讓269在你最愛的實況主開台的時候通知你。 ./images/twitch.gif

自動給成員身份組

伺服器成員可以通過按下回應的表情符號來取得特定身份組。 ./images/role.gif

如何在自己的電腦上透過bot_269主持自己的Discord機器人

你可以使用bot_269在自己的電腦上主持一個DC機器人

下載檔案

使用git

$ git clone https://github.com/funk443/bot_269.git

直接下載zip檔

如果你不會使用git,可以選擇此方法。

  1. 點擊github頁面上的Code按鈕,然後按”Download ZIP” ./images/download.png
  2. 將zip解壓縮。

設定環境

GNU/Linux

  1. 透過你的套件管理員安裝python 這裡只以我用過的兩個發行版為例,其他發行版如何安裝請自行google
    • Arch GNU/Linux
      $ sudo pacman -S python 
              
    • Void GNU/Linux
      $ sudo xbps-install -S python
              
  2. 打開你的終端機,cd到bot_269目錄
    $ cd bot_269/
        
  3. 幫python安裝pip
    $ python -m ensurepip --upgrade
        
  4. 安裝所需要的python函式庫
    $ python -m pip install -r modules.txt
        

Microsoft Windows

(因為我沒用過Windows,所以指令部份可能會打錯,如有錯誤請自行google或連絡我)

  1. Python官網下載頁面下載最新版python,至少為python 3.10
  2. 走完安裝程式的安裝步驟
  3. 打開命令提示字元(cmd),並輸入以下指令
    py -m ensurepip --upgrade
        
  4. cd到你bot_269的資料夾(假設你剛剛解壓縮到D槽)
    D:
    cd bot_269
        
  5. 安裝所需要的python函式庫
    py -m pip install -r modules.txt
        

設定Discord開發者環境和金鑰

創建一個新的應用程式

  1. Discord開發者頁面,並依畫面指示登入自己的Discord帳號
  2. 確定自己在Application分頁,然後點選右上的New Application,並依指示輸入名字後創建 ./images/dc_app.png

創建一個新的bot

  1. 接著點選剛剛創建的應用程式頁面左側選單中的bot,並點選Add bot ./images/dc_app_bot.png
  2. 在bot的頁面中填入你想要的機器人名字和設定個人資料圖片,並確保:
    • Public Bot
    • Presence Intent
    • Server Members Intent
    • Message Content Intent

    是向右開啟狀態 ./images/dc_app_bot_intent.png

  3. 按下Reset Token按鈕,並將他給你的金鑰複製到bot_269目錄下的TOKEN檔案中。

將機器人邀請進你的伺服器裡

  1. 點選在應用程式頁面左側選單中OAuth2下的URL Generator,並勾選如圖權限: ./images/dc_app_url.png
  2. 複製所產出網址就是邀請機器人的網址了

設定twitch應用程式

  1. 前往Twitch開發者頁面,並從右上角登入
  2. 登入後按右上角Your Console按鈕
  3. 點選註冊您的應用程式,並輸入名稱,選擇分類。OAuth重新導向網址請填 http://localhost
  4. 到剛剛註冊的應用程式頁面,按下新密碼按鈕。並分別將用戶端ID和用戶端密碼複製到bot_269目錄下twitch.json中, ID複製到key後面的雙引號,密碼複製到secret後面的雙引號內

啟動你的機器人吧

  1. 打開你的終端機/命令提示字元(cmd),並cd到bot_269的目錄中
  2. 輸入以下指令:
    • GNU/Linux
      $ python bot.py
              
    • Microsoft Windows
      py bot.py
              
  3. 完成, 記得不可以關閉終端機/命令提示字元(cmd)的視窗!

使用說明和連絡方式

bot_269的說明可以在這裡找到。 如果有任何問題歡迎連絡我

  • Discord: ID#2120
  • e-mail: funk443@tutanota.com
  • 巴哈: CToID(funk443)