Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Liangbai2333/LRobot
封装Mirai框架的高效率机器人框架.
https://github.com/Liangbai2333/LRobot
Last synced: 26 days ago
JSON representation
封装Mirai框架的高效率机器人框架.
- Host: GitHub
- URL: https://github.com/Liangbai2333/LRobot
- Owner: Liangbai2333
- License: agpl-3.0
- Archived: true
- Created: 2020-10-02T09:08:54.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-02T17:33:39.000Z (about 4 years ago)
- Last Synced: 2024-02-12T23:15:23.607Z (10 months ago)
- Language: Java
- Size: 162 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mirai - Liangbai2333/LRobot
README
# [LRobot][0]
[0]:https://www.github.com/Liangbai2333/LRobot
`LRobot`是运行在`Mirai`框架的`动态插件加载框架`,基于`ASM`+`URLClassLoader`与一套注解系统(开发中)实现,现已支持Java, Kotlin语言。
## 声明
* 本项目仍在开发阶段,所有API都有可能在并不知情的情况下删除。
* `LRobot` 采用 `AGPL 3.0` 协议开源。
## 未来计划
* 支持 C++、C、EPL等语言。
## 极简示例
Java:
```
@Plugin(name = "Example", version = "1.0", author = "Liangbai")
@SubscribeEvent
public class Example extends JavaPlugin {
@Override
public void onEnable() {
Bot.getGroup(123456).sendMessage(
"插件启动"
);
}
@EventHandler
public static void onMsg(GroupMessageEvent event) {
event.getGroup().sendMessage(
LR.at(event.getSender())
+ "[复读] "
+ event.getMessage()
);
}
}
```
Kotlin:
```
@Plugin(name = "Example", version = "1.0", author = "Liangbai")
class Example : JavaPlugin() {
override fun onEnable() {
Bot.getGroup(123456).sendMessage(
"插件启动"
EventUtils.registerEvents(this, object : Listener {
@EventHandler
fun onMsg(event: GroupMessageEvent)
{
event.group.sendMessage(
"${LR.at(event.sender)}
[复读] ${event.message}"
)
}
)
}
}
```
## 指令系统
目前有两个指令注册方式:
- 在实现CommandExecutor的public类上添加注解@CommandVisitor(commandName),插件加载时会自动识别并加载它.
- 使用LRobot#getCommandMap#register方法.
## 监听系统
监听方法实例:
@EventHandler
public (static) void onEvent(GroupMessageEvent event)
其中EventHandler不可缺失.
目前有两个监听注册方式:
- 在public类上添加注解@SubscribeEvent,并将所有监听方法标识为static,插件加载时会自动识别并加载它.
- 使用EventUtils#registerEvents方法.
## 开源许可证
```
Copyright (C) 2020 Liangbai Technologies and contributors.This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
```
## 鸣谢: Bukkit, Intellij IDEA