Coder Social home page Coder Social logo

huyanauthorize's Introduction

HuYanAuthorize 壶言鉴权

说明

一个用于针对简化mirai插件开发的前置插件,简化的内容为:

  • 自动化添加消息监听
  • 针对用户(Friend),群(Group),群成员(GroupMember)都有独立的权限
  • 权限可自定义跟改,权限类别也可以自定义添加
  • 自动匹配触发内容(直接匹配或正则匹配)

使用

  • 添加依赖

在build.gradle中

    dependencies {
    compileOnly("cn.chahuyun:HuYanAuthorize:1.0.0")
}

在插件的onLoad方法中启用

        //添加本插件的注册消息包信息
        PermissionServer instance=PermissionServer.getInstance();
        instance.init(INSTANCE,"cn.chahuyun.authorize.manager");

再在需要消息监听的类上和方法上分别添加@MessageComponent@MessageAuthorize注解

@MessageComponent //声明此类中有需要注册消息监听的方法
public class PermissionManager {

    @MessageAuthorize(text = "你好")//注册消息监听,具体参数可以查看 MessageAuthorize 注解
    public void reply(MessageEvent event) {
        event.getSubject().sendMessage("你好呀!");
    }

}

指令

命令前缀 命令 含义 案例
#hya owner 设置主人 #hya owner 572490972
v 查询当前插件版本 #hya v

配置

    # 主人
    owner: 0

开发

添加自定义权限

huyanauthorize's People

Contributors

moyuyanli 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.