Skip to content

aElHo/pbbot-vertx-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pbbot-vertx-starter

QQ群

这是一个vert.x starter,可以用于快速开发对应于 Go-Mirai-ClientSpring-Mirai-Client 的消息处理中心。

仅用于编写业务逻辑,不涉及登陆等功能,建议配合Go-Mirai-Client使用,下载地址:Go-Mirai-Client-Release

使用方法

  • pom.xml
<dependency>
    <groupId>io.github.aelho</groupId>
    <artifactId>pbbot-vertx-starter</artifactId>
    <version>0.0.1</version>
</dependency>
  • Main
import com.elho.BotVerticle;
import io.vertx.core.AbstractVerticle;

/**
 * @author zyf
 * @Date 2022-03-19
 */
public class DemoVerticle extends AbstractVerticle {
    @Override
    public void start() {
        vertx.deployVerticle(new BotVerticle());
    }
}
  • DemoPlugin
package plugin;

import com.elho.pbbot.bot.Bot;
import com.elho.pbbot.bot.BotPlugin;
import io.vertx.core.Future;
import onebot.OnebotApi;
import onebot.OnebotEvent;


public class DemoPlugin extends BotPlugin {
    @Override
    public int onPrivateMessage(Bot bot, OnebotEvent.PrivateMessageEvent event) {

        Future<OnebotApi.SendPrivateMsgResp> future = bot.sendPrivateMsg(event.getUserId(), "这是DEMO", false);
        future.onSuccess(a -> {
            logger.info("返回消息");
        });
        return MESSAGE_BLOCK;
    }
}
  • resources/application.json
{
    "port": 8081,
    "plugin": [
            "plugin.DemoPlugin",
            "plugin.TextPlugin"
    ]
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages