your current location:首页 > news>Simple configuration of cross-service chat+QQ robot (suitable for any server) -ChatBridge [CMA] Carpet-MCT AdDition

Simple configuration of cross-service chat+QQ robot (suitable for any server) -ChatBridge [CMA] Carpet-MCT AdDition

2024-12-05 23:05:26|Myriagame |source:minecraft skins

This tutorial is set by the author to use the CC By-NC-SA protocol.

This cross -service chat is based on MCDR. MCDR is a common tool for raw electric uniforms. Installation/use instructions here, no longer repeat the Fallen_Breath tutorial

In order to get the best viewing experience, you can move to my blog to watch blogs

1 preface

Chatbridge is a MCDR plugin, which is used to synchronize messages between different servers (hereinafter referred to as CB)

This tutorial is not difficult. If you are not proficient in server management, you can also master it. Please configure it patiently.

2 CB configuration

Please make sure that the server has been installed with MCDR

To run CB, execute the following command to install dependencies

 PIP3 Install PyCryptodome 
 PIP3 Install ColorLog 

If the following problems occur, please check the virtual environment related information

 ❯ PIP3 Install JSON

Error: Externally-Managed-Evalonment

× This Environment is External Managed

St—> To Install Python Packages System-Wide, Try 'Pacman -S

Python-xyz ', where xyz is the package you are trying to

Install.

Suppose there are two servers, one is a survival service, and the other is a creation service

Here we need three Screen to run three server, namely the CB server, the survival server, and the creation service side

You can run the CB server and create a server to run a server to save resources

2.1 Configuration of the CB server

Find Chatbridge.pyz and throw it into a separate folder

CD to this directory, run

 python3 Chatbridge.pyz server 

After running an error and exit, at the same time, the Chatbridge_Server.json will be generated in this directory.

Modify the configuration of the file as follows

 {{

"AES_KEY": "ThiSisthesecret",

"Hostname": "0.0.0.0",

"Port": 8124, "Clients": [[

{{

"Name": "survival service",

"Password": "Survival"

},

{{

"Name": "Create suit",

"Password": "Creative"

},

{{

"Name": "QQChannel",

"Password": "QQ"

}

],,,

"Show_Chat": true, TRUE,

"Log_chat": true

}

explain

-` "AES_KEY": "ThiSistHesecret" `: encrypted key, keep the default when there is no special purpose.

-` "Hostname": "0.0.0.0" `: Local address, usually no change.

-` "port": 8124`: service port number.

-` "clients" `: server configuration that needs to be synchronized, including names and passwords.

-` "Show_Chat": True`: Do you display chat information on the console.

-` "Log_Chat": True`: Whether to record chat information.

Rest reorganization after the modification is completed

 python3 Chatbridge.pyz server 

Normal operation output is as follows

 AES Key = ThiSisthesecret

Server address = 0.0.0.0:8125

-Client#1: name = survival service, password = Survival

-Client#2: name = creative clothing, password = creative

-Client#3: name = QQChannel, password = Creative

-Client#4: name = QQ, password = Creative

Lost this process in SCREEN to prevent the service from termination of the terminal

At this point, the configuration of the server is completed

2.2 Configuration of the client

Copy a Chatbridge.pyz plug -in directory of losing MCDR

After the first run server, the Chatbridge_Client.json

Modify the creation service configuration as follows

 {{

"AES_KEY": "ThiSisthesecret",

"Name": "Create suit",

"Password": "Creative",

"Server_hostname": "0.0.0.0",,

"Server_port": 8124

}

explain:

-` "AES_KEY": "ThisistHesecret" `: encrypted key consistent with the service side.

-` "name": "Create a suit" `: the server name of the client.

-` "Password": "Creative" `: The password consistent with the service side.

-` "server_hostname": "0.0.0.0" `: IP here.If the survival service and creative service are on the same server, fill in `0.0.0.0`.

-` `server_port": 8124`: The end number of the server.

Modify the survival service configuration as follows

 {{

"AES_KEY": "ThiSisthesecret",

"Name": "survival service",

"Password": "Survival",

"Server_hostname": "0.0.0.0",,

"Server_port": 8124

}

-` "aes_key" `,` server_port "`: Just like the creative suit configuration.

If "name": the post parameters are used in Chinese, please use UTF-8 coding to save, otherwise it will be garbled

The Config of the server or the MCDR, the configuration is officially completed, and now the creative service and the news of the survival service can be connected.

3 The configuration of QQ robotics

The era of Go-CQHHTP protocol library has passed. If you want to pursue stable QQ robot service, see 4 small sections

QQ message robots need two Screen to run, namely the CBQQ side and Go-CQHTTPS. The actual measurement occupies extremely low resources.

You need to prepare the following materials

-QQ trumpet

-G-cqhttp file [github download] (https://github.com/mrs4s/go-cqhttp/releases "github download"), get the program Go-Cqhttp without suffering after decompression.

3.1 Configure Go-Cqhttps server

Throw the Go-CQGTTP file in a separate folder

Run

 ./ Go-Cqhttp 

The following text appears

 No configuration file is found, and the configuration file is being generated for you!

Please select the communication method you need:

> 0: http communication

> 1: Cloud function service

> 2: Communication to WebSocket

> 3: Reverse Websocket Communication

Enter 02, turn on HTTP communication and positive WebSocket communication

The program will automatically exit and generate config.yml

Edit as follows

 uin: 123456 // 123456 and replace it with your QQ trumpet

Password: '' //*replace it with a password, use the code to log in when the password is empty

The probability of logging in here will fail, indicating that the password is error or the network environment is complicated, and the solution is as follows

3.1.1 Go-CQHTTP password Correct but still logging in the failure solution

Download here to download the Windows version of GO-CQHTTP, [github download] (https://github.com/mrs4s/go-cqhttp/releases "github download"), and put it in your computer, and the config.ymml configured config.ymlCopy to the same directory

Shift+Mouse right-click the folder in the blank area to open PowerShell, enter ./go-cqhttp

Start logging in, but still reminded the login fail

Open Device.json, change the parameter of "Protocol" from 5 to 2

 "Protocol": 2 

Try to log in again and find that the login is successful

SESSION.TOKEN and Device.json lost the original file in the server

Running Go-CQHTTP on the server

 ./ Go-Cqhttp 

At this time, the high probability login is successful, just throw the Screen hanging

Because the Tencent risk control system has changed the frequency fast, this method may fail in the future. If the above steps are correct, it is still impossible to log in, please solve it by yourself

3.2 Configure CBQQ side

Go to step 2.1 Directory that stores the ChatBridge.pyz, run Python3 Chatbridge.pyz Cqhttp_bot

It will collapse and generate Chatbridge_cqhttp.json files like 2.1

Modify the configuration of Chatbridge_cqhttp.json below

 "AES_KEY": "ThiSisthesecret", //

"Name": "QQChannel", // is the same as named in the CB server

"Password": "QQ",

"Server_hostname": "127.0.0.1", // If CBQQ and CB run on the same server, this item will not move. If it is not running on a server, enter the IP address of the CB server's IP address

"Server_port": 8124, // CB server port

"Ws_address": "127.0.0.1",

"Ws_port": 8080, // This item needs to be modified

"Access_token": "", //

"React_group_id": 123456, // 123456 changed to QQ group that needs synchronous messages

Run again after saving

 python3 Chatbridge.pyz cqhttp_bot 

In the SCREEN, at this time, the QQ group can normally receive the message sent in the MC server

The author of the CB needs to be used in MC by default !! QQ Send to QQ, you need to use it in QQ !! MC Send to MC to MC

If you want to synchronize all the message, please use this fork

4. Supplementary content: Use better QQ robot service

If your QQ robot frequently reports CODE: 45 or frequently triggers the sealing control, or even the title, please use the following scheme

If your service can run normally, you can ignore this section

The GO-CQHTTP protocol library has stopped maintenance now. The best solution is to replace Go-CQHTTP. As long as the ONEBOT service scheme can also be perfectly connected to the Chatbridge.

According to the alternative Liteloaderqqnt, there is no specific deployment plan here. If necessary

> The core idea is to replace Go-CQHTTP with LiteLoaderqqnt-LLONEBOT, the configuration in 3.2 is unchanged, and the service provided in 3.1 can be replaced.

Related links:

[LiveLoaderqqnt] (https://github.com/liteLoaderqqnt/liteLoaderqqnt)

[Llonebot] (https://github.com/llonebot/llonebot)

Please do not chat on the QQ official group and any influential simplified China Internet platform (including but not limited to: Bilibili, Weibo, Zhihu, Douyin, etc.).information

5. Summarize if the configuration is normal, there will be the following screen running

-MC survival service side

-MC creation service side

-CB server

-CBQQ service terminal

-GO-CQHTTP or other server that provides Onebotapi

If all functions run normally, congratulations, all configuration has been completed

If there is an error in this article, or if there is a problem when configured, please contact ApricityX@qq.com or [contact me] ("Add QQ")