2023-03-15
It's not working again, but there's a Fork and progress: icqqjs/icqq;
I originally wanted to implement the OneBot interface myself, which would be my first TS project, but it turned out to be quite difficult, and then I found out that it already exists: lc-cn/onebots;
2021-01-01
Cool Q is no longer usable. Switched to a Node project.
Please install git and Node.js first..
Reference: 【Tinkering】VSCode Remote Development Configuration
「AD: [ShortSth,VultrVPS][/ShortSth]」
Installation and Configuration#
# Global installation
# npm install -g onebots
cnpm install -g onebots
# Create directory
RUN_DIR=~/node/onebots
mkdir -p $RUN_DIR
cd $RUN_DIR
# Initialization
onebots -c config.yaml
# Execute again after modifying the configuration
onebots -c config.yaml
Specific configuration, how to run in the background, and then communicate with Z-BlogPHP, I haven't figured it out yet...
Persistent Running with pm2#
PM2 is a process management tool for Node.js that can simplify many tedious tasks of managing Node.js applications, such as performance monitoring, automatic restart, load balancing, etc., and it is very easy to use.
# Global installation
npm install -g pm2
# Enable persistent running
RUN_DIR=~/node/onebots
cd $RUN_DIR
# pm2 delete all
# Haven't figured it out here yet...
# pm2 start ecosystem.config.js
# pm2 logs onebots
# Auto-start on boot
pm2 save
pm2 startup
# In theory, it can listen for file changes and automatically restart, but I haven't figured it out yet
# --watch --ignore-watch="node_modules data"
Management commands
# List all processes
pm2 list
# View process information
pm2 describe onebot
pm2 logs onebot
# Stop a process
# pm2 stop app_name|app_id
pm2 stop onebot
pm2 stop all
# Delete a process
# pm2 delete app_name|app_id
pm2 delete onebot
pm2 delete all
# Auto-start on boot
pm2 save
pm2 startup
# View auto-start items on CentOS 7
# systemctl list-unit-files
systemctl list-unit-files | grep enabled
# pm2-root.service enabled