This repository has been archived by the owner on Aug 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path搭建指南-Linux.txt
82 lines (74 loc) · 3.11 KB
/
搭建指南-Linux.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---------------------- 基于腾讯云 Ubuntu 18.04 LTS ----------------------
下载文件
git clone https://github.com/haowen-li/DicePP.git
如果速度过慢, 可以试试下面这条指令
git clone https://gitclone.com/github.com/haowen-li/DicePP.git
安装python3.7
sudo apt update && sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.7
安装curl
sudo apt install curl
安装pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo apt install python3-distutils
sudo python3.7 get-pip.py
sudo pip install launchpadlib
rm get-pip.py
安装依赖库
pip3.7 install --no-cache-dir "nonebot[scheduler]" && pip3.7 install --no-cache-dir -r ./DicePP/requirements.txt
设置go-cqhttp客户端 (注意版本号可能改变,可按tab自动补全,注意系统是linux还是windows)
tar -xzvf DicePP/tools/go-cqhttp-v0.9.29-fix2-linux-amd64.tar.gz
初次运行生成配置文件
./go-cqhttp
更改配置文件
vim config.json
按i进入编辑模式
修改uin为qq账号,password为密码
将http_config,ws_config,web_ui的enabled属性都设置为false
将ws_reverse_servers的enabled属性设置为true,将reverse_url属性设置为"ws://127.0.0.1:8080/ws/"
注意本身有双引号的写在双引号里,没有则不需双引号
最后按esc退出编辑模式,输入:wq保存并退出
更改DicePP配置文件
在DicePP文件夹下新建一个文件master_config.py
touch master_config.py
更改配置文件
vim master_config.py
仿照前一步,新增如下内容,#后的内容为注释,可以不写
SELF_ID = '12345678' # 骰娘账号
MASTER = ['87654321'] # Master账号,如有多个,可以写为['87654321', '000000']的格式,注意是英文逗号
MASTER_GROUP = ['666666'] # 管理群号,目前会将加入的群自动播报至管理群,如果不需要则写为[ ]即可
GROUP_PASSWORD = '伊丽傻白' # 好友验证码,必须输入该验证码才会通过好友请求,如果不需要验证码请将其设为空字符串 ''
---------- 在服务器上的自动部署方法 ----------
安装supervisor
wget https://pypi.io/packages/source/s/setuptools/setuptools-33.1.1.zip
unzip setuptools-33.1.1.zip
cd setuptools-33.1.1
sudo python setup.py install
sudo easy_install supervisor
cd ~
rm setuptools-33.1.1.zip
创建配置文件
sudo mkdir /etc/supervisord.d
echo_supervisord_conf > ~/supervisord.conf
sudo mv ~/supervisord.conf /etc/supervisord.conf
在配置文件最后添加以下内容来包含/etc/supervisord目录,注意以下两行为一个指令
sed -i '$a [include] \
files = /etc/supervisord.d/*.conf' /etc/supervisord.conf
新建日志文件夹
mkdir ~/superlogs
复制配置文件到指定位置
sudo cp ~/DicePP/tools/dicepp.conf /etc/supervisord.d/dicepp.conf
sudo cp ~/DicePP/tools/gocqhttp.conf /etc/supervisord.d/gocqhttp.conf
启动supervisor,dicepp和gocqhttp会自动在后台开始运行
supervisord -c /etc/supervisord.conf
其他指令
supervisorctl status all #查看所有进程状态
supervisorctl stop all #停止所有进程
supervisorctl start all #启动所有进程
supervisorctl restart all #重启所有进程
supervisorctl reload #重新启动supervisor,重载配置
---------- 写在最后 ----------
注意,在自动部署前,必须先手动运行go-cqhttp确保可以正常登陆
如果按前文的方法进行了自动部署,则在启动supervisor后就可以正常使用
产生的输出会存在用户目录下的superlogs文件夹中,如果要查看可以用vim打开,按下shift+g可以快速到达最底部