New version of silly girl + docking onebot protocol + docking Qinglong tutorial

70% of this article is reprinted and 30% is supplemented. Original text: 2022 new and complete version of Qinglong panel docking robot, and silly girl docking onebot(oicq) protocol realizes robot function_ Dabei's Programming Notes blog - CSDN blog_ Qinglong panel qq robot

Solve bash: /root/sillyGirl/sillyGirl: insufficient permissions and ws reverse connection failure.

It took a long time to build the pit. csdn doesn't have a perfect tutorial in the new version of silly girl. Send an article to solve the problems that novices are easy to make.

1, Install silly girl

1. Initial installation of silly girl

#First step
cd /etc
#Step 2 (domestic server)
 
set sillyGirl download_prefix https://pd.zwc365.com/
 
#Step 3
s=sillyGirl;a=arm64;if [[ $(uname -a | grep "x86_64") != "" ]];then a=amd64;fi ;if [ ! -d $s ];then mkdir $s;fi ;cd $s;wget https://github.com/cdle/${s}/releases/download/main/${s}_linux_$a -O $s && chmod 777 $s;pkill -9 $s;$(pwd)/$s 

perhaps

#First step
cd /etc
#Step 2 (domestic server)
 
set sillyGirl download_prefix https://ghproxy.com/
 
#Step 3
s=sillyGirl;a=arm64;if [[ $(uname -a | grep "x86_64") != "" ]];then a=amd64;fi ;if [ ! -d $s ];then mkdir $s;fi ;cd $s;wget https://github.com/cdle/${s}/releases/download/main/${s}_linux_$a -O $s && chmod 777 $s;pkill -9 $s;$(pwd)/$s 

There is a pit here, that is, the installation is not successful, indicating that there is no access permission bash: /root/sillyGirl/sillyGirl: the permission is not enough

Solution: give silly girl and the folder 777 permission under silly girl.

2. Initialize configuration

Silly girl, create a new file sets Conf, deposit

# Silly girl robot name
set sillyGirl name ?
#Whether the silly girl http service is enabled. The default is false, and the enabled value is changed to true
set sillyGirl enable_http_server true
# Silly girl http service port
set sillyGirl port ?
# Silly girl message withdrawal waiting time, unit: seconds
set sillyGirl duration 5
# Will silly girl be notified of automatic upgrade
set sillyGirl update_notify true
# Whether to enable silly girl automatic update
set sillyGirl auto_update false
# Silly girl built-in appreciation code
set sillyGirl appreciate https://gitee.com/aiancandle/sillyGirl/raw/main/appreciate.jpg
# Set the client of Qinglong openapi_ ID parameter
set qinglong client_id ?
# Set the client of Qinglong openapi_ Secret parameter
set qinglong client_secret ?
# Whether Qinglong turns on the function of automatically hiding repeated tasks
set qinglong autoCronHideDuplicate true
# Set Qinglong panel address
set qinglong host ?
# Set the qqbot login account. If there are comments, scan the code to log in after running
#set qq uin ? #This should not be used now. Just log in directly with node onebot
# Set the qqbot login password. If it is commented, scan the code after running to log in
#set qq password ? #This should not be used now. Just log in directly with node onebot
# Set the group chat number to listen to by default
set qq groupCode ?
# Set the default group number of qq temporary messages
set qq tempMessageGroupCode ?
# Set whether to automatically agree to friend requests
set qq auto_friend false
# Whether to reply to the message listening to itself
set qq onself false
# Set qq administrator
set qq masters ?
# Set the qq account to accept the notification, which is accepted by the administrator by default
set qq notifier ?
# Set qq device information (automatically generated)
#set qq device.json ?
# Set qq login token (automatically generated)
#set qq session.token ?
# Set the telegram robot token
set tg token ?
# Set up telegram robot agent
#set tg http_proxy ? #I can't use it, so I annotate it. Judge according to my own network environment.
# Set up telegram robot administrator
set tg masters ?
# Set the telegram account to accept the notification, which is accepted by the administrator by default
set tg notifier ?
# Set up wechat public platform app_id
set wxmp app_id ?
# Set up wechat public platform app_secret
set wxmp app_secret ?
# Set wechat public platform token
set wxmp token ?
# Setting wechat public platform encoding_aes_key
set wxmp encoding_aes_key ?
# Set up wechat public platform administrator
set wxmp masters ?
# Set official account for event recovery
set wxmp subscribe_reply ?
# Set official account by default.
set wxmp default_reply ?
#Set the calling address of the plug-in to ensure that silly girl can access the cute cat port
set wx api_url ?
#Set the picture forwarding mode, otherwise you may be prompted that this picture comes from xx and cannot be used without permission
#set wx relay_mode true
#Set the specified forwarding address in the format of https: / / domain name / relay?url=%s, I don't know. Don't fill it in
#set wx relaier ?
#Set the dynamic network address, which is applicable to the case of silly girl's home broadband and cute cat's cloud server
set wx dynamic_ip true
#Set whether the cute cat has a dynamic network address, which is applicable to the broadband of the cute cat's family, while the silly girl is on the cloud server
#set wx keaimao_dynamic_ip true
#Set cute cat port
#set wx keaimao_port ?
#Set wechat administrator
set wx masters ?
#The second wechat framework vlw adopts HTTP API plug-in and yuque http connection
set wx vlw_addr http://ip:port
set wx vlw_token ?
# Set the short website service address and fill in the accessible address of silly girl.
set dwz address ?
# Set short URL service prefix
set dwz prefix d
# Parameter view commands. Currently, sillyGirl, reply, qinglong and otto are supported.
list ?

Configure according to your needs. There is http: / / in Qinglong's address. Open a port for silly girl, such as 8080

In the configuration area, delete "#" (it seems that only the following configurations exist) in the front of the set line, otherwise it will not take effect.

3. Reinstall silly girl

Reinstall for configuration to take effect

#First step
cd /etc
#Step 2 (domestic server)
 
set sillyGirl download_prefix https://pd.zwc365.com/
 
#Step 3
s=sillyGirl;a=arm64;if [[ $(uname -a | grep "x86_64") != "" ]];then a=amd64;fi ;if [ ! -d $s ];then mkdir $s;fi ;cd $s;wget https://github.com/cdle/${s}/releases/download/main/${s}_linux_$a -O $s && chmod 777 $s;pkill -9 $s;$(pwd)/$s 

Change this configuration later. After saving the change, send a message "restart" to the robot directly to take effect.

4. Silent silly girl

cd
cd etc/sillyGirl
./sillyGirl
./sillyGirl -d

Run ctrl c after the first three lines, and then the fourth line. This is a pit. Not being silent will lead to subsequent reverse connection failure.

2, Install onebot robot protocol

1. Install node

cd
cd /usr/local && wget https://nodejs.org/dist/v16.13.1/node-v16.13.1-linux-x64.tar.xz
xz -dk node-v16.13.1-linux-x64.tar.xz && tar -xvf node-v16.13.1-linux-x64.tar

Copy the code below in / etc/profile to the last line

export NODE_HOME=/usr/local/node-v16.13.1-linux-x64
export PATH=$PATH:$NODE_HOME/bin
export NODE_PATH=$NODE_HOME/lib/node_modules

How do you know if you have node installed JS can be entered

 

node -v


If you follow my installation, the version number is 16.13.1

2. Install pm2

npm install pm2 -g


Check whether the installation is successful

pm2 list


3. git installation

yum -y install git

4. Install onebot

git clone https://pd.zwc365.com/https://github.com/takayama-lily/node-onebot.git


If it's stuck, send it again. Remember ctrl+c (it's a little stuck...)

Then find the node onebot folder in the root folder in the final shell and click to enter,

Found config sample. js

Right click config sample. JS rename config js

Double click in

Delete all the code and change it to me, and then save it (the port you set here is the silly girl port set in the first step, not the Qinglong port) (replace all the following with the original file, and then you only modify the port: 5200, / / port. Change this to your own silly girl port, and don't change anything else)

"use strict";
// Rename this file config JS can take effect
 
module.exports = {
 
    //General configuration
    general: {
        platform:           3,      //1: Android phone 2:aPad 3: Android watch 4:MacOS 5:iPad
        debug:              false,  //Open debug
        use_cqhttp_notice:  true,   //Does the standard event format of cq notice use HTTP
 
        host:               "0.0.0.0",  //Listening host name
        port:               5200,       //port
        use_http:           false,      //Enable http
        use_ws:             false,      //Enable forward ws and use the same address and port as http
        access_token:       "",         //token to access api
        secret:             "",         //sha1 signature key of reported data
        post_timeout:       30,         //post timeout (seconds)
        post_message_format:"array",    //"string" or "array"
        enable_cors:        false,      //Allow cross domain requests
        enable_heartbeat:   false,      //Enable ws heartbeat
        heartbeat_interval: 15000,      //ws heartbeat interval (MS)
        rate_limit_interval:500,        //Use_ rate_ The queue interval (in milliseconds) between calls to api with limited suffix
        event_filter:       "",         //json format event filter file path
        post_url: [ //Reporting address, multiple URLs can be added
            // "http://your.address.com:80",
        ],
        ws_reverse_url: [ //Reverse ws address, multiple URLs can be added
             "ws://127.0.0.1:8080/qq/receive",
        ],
        ws_reverse_reconnect_interval: 3000, //Reverse ws disconnection reconnection interval (MS), set to a negative number and do not reconnect directly
        ws_reverse_reconnect_on_code_1000: true, //Whether the reverse ws reconnects when the shutdown status code is 1000
    },
 
    //Individual configuration of each account (used to override the general configuration)
    147258369: {
 
    },
};
 
// Safety precautions:
// Listening 0.0.0.0 means listening to all addresses on the network card. If your machine can be accessed directly through public ip, and you don't set access_token is considered extremely unsafe.
// You should know that doing so will lead to the following consequences: anyone can have unlimited access to all API interfaces of your Bot.
// If you only need to access locally, it is recommended to change the listening address to localhost. If you need to access through the public network, you'd better set access_token. 

Log in to the robot trumpet (enter enter in the final shell command input box, line by line) (here is the trumpet you want to be a robot. It is recommended to register a new one as a robot trumpet.) (change the robot QQ to your own)

cd
cd node-onebot
node main robot QQ


Don't scan the code to log in. Here, select the password to log in, enter the password and press enter. The first time, copy the slider link, open the browser, right-click to review the element or check, switch to network, slide the slider, and a request will appear. Check that there is a ticket in the response of the request. Copy the value of the ticket in the quotation mark to the finalssh command input box and press enter to show that the login is successful, Prompt of successful reverse connection

If you are prompted that you cannot log in with a password due to security problems, scan the code first. The next day, check the robot. If it is not online, scan the code again. After hanging out the common ip for 3-5 days, try to log in with a password. The validity period of password login is very long. Generally, the robot will be disconnected in 1-2 days

Press ctrl+c to exit, and then run the guard again in pm2 mode

pm2 start "node main robot QQ number"


Display login success and prompt reverse login success

If you don't show that the reverse connection is successful, most of the silly girl is lost. In the window in the first step, click cd to the corresponding directory/ sillyGirl and/ After the silltGirl -d is repeated, run onebot in the window of the second step and log in again. The reverse connection is successful,
 

Butt cheese


Send qq to your robot in the administrator qq in your first step (qq dialogue interface)

set jd_cookie enable_jd_cookie true


The robot replies that your cheese is turned on successfully, so that your robot can really run

Here are some common commands

command         Get robot commands

set pinQQ pt_pin qq number         #Bind qq number to ck account, for example, set pinQQ jd_xxxxxx 123456

query ?     #Query the assets of the specified account number

query            Query current account assets

pt_key=([^;=\s]+); pt_pin=([^;=\s]+)    #The administrator sends the cookie to the robot to automatically bind and send qq

How can robots be used by others? Let your friends add robot friends

Sending his cookie s to the robot is similar

pt_key=([^;=\s]+); pt_pin=([^;=\s]+)
In this way, his qq will be bound to this cookie, and this cookie will also appear on your Qinglong panel. He can query beans by sending a query to the robot or in the group in the settings configuration in the first step (it is suggested that it is more convenient to set the automatic receiving friends in the sets file in the first step to true)


 

Keywords: Linux Operation & Maintenance CentOS

Added by akillez on Fri, 11 Feb 2022 09:46:13 +0200