|
| 1 | +# AI キャル v3 |
| 2 | + |
| 3 | +為公主連結所設計的 Discord 聊天機器人 |
| 4 | + |
| 5 | + |
| 6 | +[](https://discord.gg/cwFc4qh) |
| 7 | +[](https://discordapp.com/oauth2/authorize?client_id=594885334232334366&permissions=8&scope=applications.commands%20bot) |
| 8 | +[](https://iandesuyo.notion.site/AI-v3-baec83903f764b7f95d0186f105190ee) |
| 9 | + |
| 10 | +# 安裝方式 |
| 11 | + |
| 12 | +## 前置需求 |
| 13 | + |
| 14 | +在開始安裝前, 請先完成下列步驟 |
| 15 | + |
| 16 | +- 於[Discord Developer Portal](https://discord.com/developers/applications/)建立一個Bot |
| 17 | +- 擁有一個[mongoDB](https://www.mongodb.com/), 並建立名為`AIKyaru`的 Database 及名為`guild`, `user`的 Collections |
| 18 | +- 閱讀 [設定說明](#設定說明) 來完成`config.json`之設置 |
| 19 | + |
| 20 | +## Docker |
| 21 | + |
| 22 | +要使用 Docker 運行, 你可以直接使用下列指令來建置與運行 |
| 23 | + |
| 24 | +```bash |
| 25 | +docker build -t ai_kyaru . |
| 26 | + |
| 27 | +docker run -d \ |
| 28 | + --name ai_kyaru \ |
| 29 | + -e BOT_TOKEN=YOUR_BOT_TOKEN \ |
| 30 | + -v /path/to/config.json:/app/config.json \ |
| 31 | + ai_kyaru |
| 32 | +``` |
| 33 | + |
| 34 | +## 手動安裝 |
| 35 | + |
| 36 | +在開始安裝前, 建議先使用 virtualenv 創建虛擬環境, 並設置環境變數`TOKEN` |
| 37 | + |
| 38 | +```bash |
| 39 | +pip3 install -r requirements.txt |
| 40 | + |
| 41 | +BOT_TOKEN=YOUR_BOT_TOKEN |
| 42 | + |
| 43 | +python3 main.py |
| 44 | +``` |
| 45 | + |
| 46 | +# 設定說明 |
| 47 | + |
| 48 | +除了 Discord 機器人的 Token 外, 其餘設定皆儲存於`config.json` |
| 49 | + |
| 50 | +首次設定時, 請先參考`config.json.example`內的格式並修改設定值 |
| 51 | + |
| 52 | +```json |
| 53 | +{ |
| 54 | + "status": "online", // 機器人的上線狀態 |
| 55 | + "activity": { |
| 56 | + // 根據下方設定, 結果為 "正在看 .help|ヤバイわよ!!" |
| 57 | + "type": 3, // 機器人的狀態, playing=0, streaming=1, listening=2, watching=3 |
| 58 | + "prefix": ".help|", // 機器人狀態的前綴 |
| 59 | + "default_text": "ヤバイわよ!!" // 預設狀態文字 |
| 60 | + }, |
| 61 | + "prefix": ".", // 指令前綴 |
| 62 | + "cogs": [ |
| 63 | + // 需要載入的Cogs |
| 64 | + "cogs.admin", // 管理員功能 |
| 65 | + "cogs.rubiBank", // 盧幣銀行 |
| 66 | + "cogs.character", // 角色相關資訊查詢 |
| 67 | + "cogs.profileCard", // 個人檔案 |
| 68 | + "cogs.common", // 基本功能, 如體力計算及抽卡模擬 |
| 69 | + "cogs.newsForward", // 簡易設定公告轉發 |
| 70 | + "cogs.preferences", // 偏好設定 |
| 71 | + "cogs.clan", // 戰隊系統 |
| 72 | + "cogs.response", // 基本回覆 |
| 73 | + "cogs.tasks" // 排程任務 |
| 74 | + ], |
| 75 | + "helpTitle": "哈囉~ 歡迎使用 AI キャル", // 使用help時的主要提示文字 |
| 76 | + "AssetsURL": "https://randosoru.me/static/assets", // 圖片素材之網址 |
| 77 | + "RediveJP_DB": [ |
| 78 | + "https://redive.estertion.win/db/redive_jp.db.br", // 日版資料庫 |
| 79 | + "https://redive.estertion.win/last_version_jp.json" // 日版資料庫版本 |
| 80 | + ], |
| 81 | + "RediveTW_DB": [ |
| 82 | + "https://randosoru.me/redive_db/redive_tw.db.br", // 台版資料庫 |
| 83 | + "https://randosoru.me/redive_db/version.json" // 台版資料庫版本 |
| 84 | + ], |
| 85 | + "keywordGSheet": { |
| 86 | + // 於Google Sheets上的角色關鍵字匹配表 |
| 87 | + "key": "12QiLoCODWr4TRVGqwXROCYenh2xz-ZXqhDMgzUi7Gz4", |
| 88 | + "gid": "755815818" |
| 89 | + }, |
| 90 | + "DEBUG_CHANNEL": null, // Discord文字頻道ID, 供傳送錯誤訊息用 |
| 91 | + "MONGODB_URL": "mongodb://username:password@host:port", // MongoDB網址 |
| 92 | + "GUILD_API_URL": "https://guild.randosoru.me/api", // 戰隊管理協會API |
| 93 | + "GUILD_API_TOKEN": "GUILD_API_TOKEN", // API Token |
| 94 | + "GAME_API_URL": "https://example.com", // 個人檔案API |
| 95 | + "GAME_API_TOKEN": "GAME_API_TOKEN", // API Token |
| 96 | + "PCRwiki": "https://pcredivewiki.tw/Character/Detail", // 蘭德索爾圖書館 角色資訊頁面之網址 |
| 97 | + "EmojiServers": { |
| 98 | + // 抽卡模擬時所使用之emojis, emoji名稱需為4位數unit_id |
| 99 | + "1": [802234826413178920], // 1星角色之Discord伺服器ID |
| 100 | + "2": [802241470878187570], // 2星角色之Discord伺服器ID |
| 101 | + "3": [802241643121999883], // 3星角色之Discord伺服器ID |
| 102 | + "Pickup": [850065739590139957] // Pickup角色之Discord伺服器ID |
| 103 | + }, |
| 104 | + "RankData": { |
| 105 | + // Rank推薦來源 |
| 106 | + "emonight": { |
| 107 | + // 漪夢奈特emonight所提供之Google Sheets表格 |
| 108 | + "key": "", |
| 109 | + "gid": "", |
| 110 | + "sql": "select%20*" |
| 111 | + }, |
| 112 | + "nonplume": { |
| 113 | + // 無羽nonplume所提供之Google Sheets表格 |
| 114 | + "key": "", |
| 115 | + "gid": "", |
| 116 | + "sql": "select%20*" |
| 117 | + } |
| 118 | + } |
| 119 | +} |
| 120 | +``` |
| 121 | + |
| 122 | +備註: |
| 123 | + |
| 124 | +- 上方 Google Sheets 之`key`與`gid`可於網址內獲取, 例如` https://docs.google.com/spreadsheets/d/{key}/edit#gid={gid}` |
| 125 | +- 4 位數 unit_id 之格式為`1xxx`, 如凱留為`1060` |
| 126 | +- 若需使用戰隊管理協會 API, 請聯繫我申請 |
0 commit comments