Python Development Of Cool Q Plug-in Gui_cool Q Robot Plug-in Development Notes

Cool Q Robot is a free QQ robot framework. The developer provides a variety of SDKs, allowing others to quickly get started and develop plug-ins with various interesting functions.

This note is from my personal perspective, using the first "Tic-Tac-Toe" plug-in I wrote as an example to analyze the C++ development process of the Cool Q robot plug-in from scratch.Of course, this article will not involve the functional implementation of Tic-Tac-Toe. If you are curious, please download the source code directly to study Cool Q Tic-Tac-Toe.

SDK composition

After downloading the C++ version of the SDK, open the project file, and we will see the above files in the solution manager. Of course, I renamed the project name and .json file, so it will be different. Among them, the following are often used in our development:

.h

Cool q robot guessing number game plug-in_Library used in guessing number games_Word guessing robot

cqp.h

.cpp

com..democ.json

Let’s introduce them respectively:

.h

The contents of this header file are as follows:

Library used in guessing number games_Cool q robot guessing number game plug-in_Word guessing robot

It is mainly used to identify the plug-in when KuQ loads the plug-in. When using it for the first time, the developer needs to change the subsequent content to his own content as the unique ID of this plug-in.

cqp.h

This header file is very important, the specific content is as follows:

The file lists all the functions currently provided by KuQ and how to use them, for example: () (, QQID, const char *msg);

Library used in guessing number games_Cool q robot guessing number game plug-in_Word guessing robot

Refers to the function of sending private messages, which can be called like this (ac, , ); "ac" is a fixed syntax, there is no reason; "" is a number in int64 format, which stores the QQ number of the sending target, "" is char *Character or character array in format. If you use char[] or format to store characters, you need to convert them to char *format before calling this function.

The return value of the function can be seen in the Debug window of Cool Q

.cpp

This file is very important, and it is also the file that developers mainly modify. The specific content is as follows:

The file lists all the event monitoring functions currently provided by Cool Q, which is the implementation principle of the Cool Q robot: using the event monitoring callback function to call the methods in it after learning that the corresponding event has occurred, to implement various custom functions

Cool q robot guessing number game plug-in_Word guessing robot_Libraries used in guessing number games

For example, the following function: 1

(, , 24)( , msgId, , const char *msg, font) {

//If you want to reply to a message, please call the cool Q method to send it, and here – truncate this message and no longer process it. Note: When the application priority is set to "Highest" (10000), this return value must not be used

//If you do not reply to the message, it will be handled by subsequent applications/filters. Here – ignore this message

;

When KuQ learns of the event "someone sends a private message", it executes this function and calls various content written by developers, such as sending back private messages.Each function accepts different formal parameters, which are basically enough for developers to use. For example, "" stores the QQ number of the other party. If you want to send back a message, directly pass this formal parameter into (ac, , msg); that is, Can

Library used in guessing number games_Cool q robot guessing number game plug-in_Word guessing robot

com..democ.json

The contents of this file are as follows:

Developers need to write in their plug-in information and delete some unused permissions

Cool Q principle

slightly

Plug-in generation

After the plug-in development is completed, compile and automatically generate the dll file. Put the dll and json into the app folder in the root directory of KuQ to test the plug-in.Once the function is normal, it can be packaged and released online.

Leave a Reply

Your email address will not be published. Required fields are marked *