Coder Social home page Coder Social logo

freght / simpler-robot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from simple-robot/simpler-robot

0.0 0.0 0.0 13.14 MB

Simple Robot,一个通用的bot风格事件调度框架,以灵活的统一标准来编写bot应用。simpler-robot是用于区别于旧版本仓库 simple-robot 的新版本命名。

Home Page: https://simbot.forte.love

License: GNU Lesser General Public License v3.0

Java 0.20% Kotlin 99.80%

simpler-robot's Introduction

logo

- Simple Robot -

~ simbot v3 ~
GitHub    |    Gitee
> 感谢 CatCode 开发团队成员制作的simbot logo <
> 走过路过,不要忘记点亮一颗⭐喔~ <
release release doc
stars forks watchers repo-size issues last-commit search-hit top-language copying

简介

Simple Robot 是一个JVM平台(和多平台)的bot风格事件调度框架(下文简称simbot),提供统一的异步API和易用的风格设计,可以协助你更快速高效的编写bot风格的事件调度应用。目前主要应用于对接各种类型的bot应用平台/框架,并提供统一的API实现。

simbot 通过 Kotlin 语言开发并兼容Java(jdk8+)等JVM平台语言,且提供Javaer最爱的Spring Boot Starter,协助你快速开发。



如果你想参考simbot2, 可以参考 simple-robot-v2

文档

对于使用文档,可以去看看 Simple Robot 3 官方网站 (尚在更新,并不完整), 而API文档则可以前往 API doc 看看。API文档归根随着版本的发布而同步更新。

而这些内容,你都可以在 Simple Robot 图书馆 处找到。

除了这些,还有一个可以简单作为参考的路线图,会简单记录计划中未来可能会进行的工作。

组件

在simbot3相关的系列组件中,大部分需要依赖第三方库(也有可能是由simbot团队实现的)的组件,基本上都会使用独立的仓库进行管理, 并且会尽量遵循simbot3的 命名概述 中所约定的规则。
simbot3目前已经实现的组件有:

组件目标 作者/团队 仓库地址 状态
Mirai simbot team simple-robot/simbot-component-mirai 维护中
Kook(开黑啦) simbot team simple-robot/simbot-component-kook 维护中
QQ频道机器人 simbot team simple-robot/simbot-component-tencent-guild 维护中

有关于这些组件等simbot附属内容的相关信息,你可以从 Simple Robot 附属组织库 处查看~

快速开始

你可以前往 官方网站文档内查看与快速开始有关的内容。

文档尚在编撰完善中...

信息资讯

如果你想要时刻关注版本的发布信息,你可以通过GitHub的 Watch 功能来订阅包括 Releases 在内的各种仓库资讯。

如果你感兴趣,可以时不时的去 Simple Robot Blog 看一看, 那里会有基本上每周更新的 周报 以及一些其他可能不定时更新发布的博客,或者碎碎念!

协助我们

为我们点亮一个✨star🌟便是能够给予我们继续走下去的最大动力与支持!

  • 你可以通过 PR 为项目代码作出贡献。
  • 你可以通过 ISSUES 提出一个建议或者反馈一个问题。
  • 你可以通过 讨论区 与其他人或者simbot开发团队相互友好交流。
  • 如果你通过此项目创建了一个很酷的项目,欢迎通过 ISSUES讨论区 等方式联系团队开发人员,并将你酷酷的项目展示在作品展示区。

联系我们

  • 如果想要反馈问题、提出建议建议或提出问题,请通过 ISSUES
  • 如果想要与开发团队交流、与其他开发者交流,请前往 讨论区

走马观花

事件监听(标准库)

suspend fun main() {
    // 构建Application
    val app = createSimpleApplication {  }
    // 注册监听函数
    app.eventListenerManager.listeners {
    // 注册一个 '好友消息' 事件
    FriendMessageEvent { event ->
        event.reply("你也好")
      } onMatch { textContent == "你好" }
    }
    // 挂起并直到被关闭
    app.join()
}

事件监听(BOOT)

@Listener
@Filter("喵{1,3}")   // match: 喵,喵喵,喵喵喵
suspend fun FriendMessageEvent.onEvent() {
  // ...
}
@Listener
@ContentTrim // 匹配前trim
@Filter("喵{1,3}") // match: 喵,喵喵,喵喵喵
suspend fun FriendMessageEvent.onEvent() {
  // ...
}

消息发送

@Listener
suspend fun GroupMessageEvent.onEvent() {
    group().send(At(114.ID) + "喵!".toText() + Face(514.ID))
}

会话

@Listener
suspend fun FriendMessageEvent.onEvent(session: ContinuousSessionContext) {
    // import love.forte.simbot.event.invoke
    val nextEvent: FriendMessageEvent = session { next(FriendMessageEvent) }
    session {
        val next1: FriendMessageEvent = next(FriendMessageEvent)
        val next2: FriendMessageEvent = next(FriendMessageEvent)
        val next3: FriendMessageEvent = next(FriendMessageEvent)
        // ...
    }
}

Java(Spring Boot Starter)

@SpringBootApplication
@EnableSimbot // 启用
public class MyApplication {
    public static void main(String[] args) {
        SpringApplication.run(MyApplication.class, args);
    }
    
    /** 事件监听 */
    @Listener
    public void onFriendMessage(FriendMessageEvent event) {
        event.replyBlocking("Hello, ");
        event.getFriend().sendAsync("Simbot");
        // 阻塞或异步的不同风格的Java API
    }
}

特别鸣谢

jetbrains

感谢 Jetbrains 为团队提供的免费授权,也希望大家能够支持 Jetbrains 及其产品,支持正版。

贡献你的星星!

Star History Chart

powered by Star History

开源协议

Simple Robot 3LGPL 3.0 协议开源。

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.