cqjavaapi

cq java api base on cqsockerapi

License

License

GroupId

GroupId

com.github.bpazy
ArtifactId

ArtifactId

cqjavaapi
Last Version

Last Version

0.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

cqjavaapi
cq java api base on cqsockerapi
Project URL

Project URL

https://github.com/Bpazy/cqjavaapi
Source Code Management

Source Code Management

https://github.com/Bpazy/cqjavaapi

Download cqjavaapi

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.bpazy/cqjavaapi/ -->
<dependency>
    <groupId>com.github.bpazy</groupId>
    <artifactId>cqjavaapi</artifactId>
    <version>0.2.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.bpazy/cqjavaapi/
implementation 'com.github.bpazy:cqjavaapi:0.2.1'
// https://jarcasting.com/artifacts/com.github.bpazy/cqjavaapi/
implementation ("com.github.bpazy:cqjavaapi:0.2.1")
'com.github.bpazy:cqjavaapi:jar:0.2.1'
<dependency org="com.github.bpazy" name="cqjavaapi" rev="0.2.1">
  <artifact name="cqjavaapi" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.bpazy', module='cqjavaapi', version='0.2.1')
)
libraryDependencies += "com.github.bpazy" % "cqjavaapi" % "0.2.1"
[com.github.bpazy/cqjavaapi "0.2.1"]

Dependencies

runtime (3)

Group / Artifact Type Version
org.slf4j : slf4j-api jar 1.7.21
ch.qos.logback : logback-classic jar 1.2.1
com.google.guava : guava jar 21.0

Project Modules

There are no modules declared in this project.

cqjavaapi

Maven Central

酷Q Java API base on cqsocketapi

Gradle:

compile 'com.github.bpazy:cqjavaapi:0.2.1'

Maven:

<dependency>
  <groupId>com.github.bpazy</groupId>
  <artifactId>cqjavaapi</artifactId>
  <version>0.2.2</version>
</dependency>

注意

请先安装酷Q并启用cqsocketapi插件

一分钟使用

// Create CqServer, this is the entrance.
CqServer server = new CqServer();

// Add your custom code with MessageHandler or CqMessageHandler.
server.addMessageHandler(new CqMessageHandler() {

    // Discuss message handler
    @Override
    public boolean discussMessage(DiscussMessage msg) {
        if (msg.getText().equals("我爱你")) {
            // Obtain default message sender and then send discuss message.
            CqSender.getDefaultSender().sendDiscussMsg(msg.getDiscussID(), "我也爱你");
        }
        // Return false if you have not completed the handler.
        // And pass the message to the next handler until true.
        return false;
    }
});
// Start server with your favorite port.
server.listenAndServe(1994);

说明

CqServer 主服务类,
CqMessageHandler 信息处理器,实现了MessageHandler接口,
MessageHandler 信息处理接口,包含:

privateMessage (私人信息处理器),
groupMessage (群信息处理器),
discussMessage (讨论组信息处理器),
groupMemberDecrease (群组减员信息处理器),
groupMemberIncrease (群组增员信息处理器)

CqSender 信息发送类

Versions

Version
0.2.1
0.2.0
0.1.3