This repository was archived by the owner on Sep 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
部署Node Countdown Bot
Antares edited this page Sep 1, 2020
·
3 revisions
此时默认用户已经装好了Node.js和yarn
Docker安装参考TUNA的教程
apt update
apt install -y git sqlite3cd /opt/bot
git clone https://github.com/AntaresQAQ/Node-Countdown-Bot.git进行相关配置
cd Node-Countdown-Bot
yarn
cp config-default.json config.json编辑config.json
{
"koishi": {
"type": "ws",
"port": 6700,
"server": "http://127.0.0.1:6700",
"token": "<和 go-cqhttp 的 access_token 保持一致>",
"secret": ""
},
"cqhttp_path": "/opt/bot/cqhttp",
"commandPrefix": [
"<指令前缀列表,自行修改>",
"--",
"!!"
],
"debug": false
}这些模块必须配置正确,否则程序无法正常启动。
cd /opt/bot/Node-Countdown-Bot/modules/CodeRunner/docker
docker build .
cd ..
vim config.json参考index.js的configDefault对象编辑config.json,通过 docker images 命令找到 bot_code_runner 的 Image ID 填入配置文件的 docker_image 字段上。
cd /opt/bot/Node-Countdown-Bot/modules/PortraitAnimation
vim config.json参考index.js的configDefault对象编辑config.json
去百度AI开放平台创建应用,获取 API Key 和 Secret Key
{
"baidu_client_id": "<这里填写 API Key>",
"baidu_client_secret": "<这里填写 Secret Key>"
}cd /opt/bot/Node-Countdown-Bot/modules/Read
vim config.json去阿里云 RAM 访问控制,创建子用户并开启只能语音交互的权限,得到 AccessKey ID 和 AccessKey Secret
去阿里云智能语音交互平台创建应用,得到 AppKey
{
"appKey": "<这里填写 AppKey>",
"accessKeyId": "<这里填写 AccessKey ID>",
"accessKeySecret": "<这里填写 AccessKey Secret>"
}cd /opt/bot/Node-Countdown-Bot/modules/Weather
vim config.json去和风天气注册账号创建应用,得到 API KEY
{
"api_key": "<这里填写 API KEY>"
}[Unit]
Description=CountdownBot service
After=network.target rc-local.service
Requires=rc-local.service
[Service]
Type=simple
WorkingDirectory=/opt/bot/Node-Countdown-Bot
User=root
Group=root
ExecStart=/usr/bin/node /opt/bot/Node-Countdown-Bot/run.js
RemainAfterExit=yes