GithubHelp home page GithubHelp logo

sjc981231 / pbbot-spring-boot-starter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from protobufbot/pbbot-spring-boot-starter

0.0 0.0 0.0 181 KB

QQ机器人的spring boot starter,推荐基于这个进行快速开发。本项目使用MIT协议,如果Client选择Mirai请使用AGPLv3协议。

License: MIT License

Kotlin 100.00%

pbbot-spring-boot-starter's Introduction

Pbbot-Spring-Boot-Starter

QQ群

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

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

文档:https://blog.lz1998.net/blogs/bot/2020/pbbot-doc/

例子:https://github.com/ProtobufBot/Spring-Mirai-Server

使用方法

  • pom.xml
    <dependency>
        <groupId>net.lz1998</groupId>
        <artifactId>pbbot-spring-boot-starter</artifactId>
        <version>0.0.19</version>
    </dependency>

最新版:maven

  • HelloPlugin
package com.example.demo.plugin;

import net.lz1998.pbbot.bot.Bot;
import net.lz1998.pbbot.bot.BotPlugin;
import net.lz1998.pbbot.utils.Msg;
import onebot.OnebotEvent;
import org.jetbrains.annotations.NotNull;
import org.springframework.stereotype.Component;


@Component
public class HelloPlugin extends BotPlugin {
    @Override
    public int onPrivateMessage(@NotNull Bot bot, @NotNull OnebotEvent.PrivateMessageEvent event) {
        Msg msg = Msg.builder()
                .text("123")
                .face(1);
        bot.sendPrivateMsg(event.getUserId(), msg.build(), false);
        return super.onPrivateMessage(bot, event);
    }
}
  • application.yml
spring:
  bot:
    plugin-list: 
      - com.example.demo.plugin.HelloPlugin
server:
  port: 8081

pbbot-spring-boot-starter's People

Contributors

lz1998 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.