安装前准备

请确保已完成运行环境准备(Python 3.10+Node.js 20+

1. 安装NapCat

下载并运行安装脚本

# 下载NapCat安装脚本 curl -o napcat.sh https://nclatest.znin.net/NapNeko/NapCat-Installer/main/script/install.sh # 运行安装脚本 bash napcat.sh

安装选项说明:

启动NapCat

# 启动NapCat并登录QQ napcat start <你的QQ号>

重要提示:

2. 安装GracyBot

下载项目文件

# 进入root目录(或其他你选择的目录) cd /root # 下载GracyBot项目 curl -O https://gracybot.xyz/appcore-latest/GracyBot.zip # 解压项目文件 unzip GracyBot.zip # 进入项目目录 cd GracyBot

设置虚拟环境并安装依赖

# 创建Python虚拟环境 python3 -m venv venv # 激活虚拟环境 source venv/bin/activate # 安装项目依赖 pip install -r requirements.txt

3. 启动项目

测试启动

# 在项目目录下启动GracyBot python3 bot.py

设置系统服务(推荐)

# 创建systemd服务文件 sudo nano /etc/systemd/system/bot.service

在服务文件中添加以下内容(如果项目不在/root目录,请相应修改路径):

[Unit] Description=GracyBot QQ Robot After=network.target [Service] Type=simple User=root WorkingDirectory=/root/GracyBot ExecStart=/root/GracyBot/venv/bin/python3 /root/GracyBot/bot.py Restart=always RestartSec=3 [Install] WantedBy=multi-user.target

说明:以上路径假设项目在/root/GracyBot目录。如果你选择其他目录,请相应修改WorkingDirectory和ExecStart中的路径。

启用服务

# 重新加载systemd配置 sudo systemctl daemon-reload # 启动GracyBot服务 sudo systemctl start bot # 设置开机自启 sudo systemctl enable bot # 检查服务状态 sudo systemctl status bot

4. 验证安装

查看运行日志

# 实时查看GracyBot日志 tail -f /root/GracyBot/bot.log

测试功能

服务管理命令

# 停止服务 sudo systemctl stop bot # 重启服务 sudo systemctl restart bot # 查看服务状态 sudo systemctl status bot

✅ 完成以上步骤后,GracyBot即安装完成并运行在后台,可前往 具体操作(含核心命令) 学习Bot基础使用。