Skip to content

Commit

Permalink
Update version to v2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ForteScarlet committed Nov 11, 2021
1 parent 2c95254 commit 48aec73
Show file tree
Hide file tree
Showing 28 changed files with 109 additions and 165 deletions.
2 changes: 1 addition & 1 deletion component/component-ding/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<artifactId>component-parent</artifactId>
<groupId>love.forte.simple-robot</groupId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
115 changes: 27 additions & 88 deletions component/component-kaiheila-parent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
标准的开黑啦-simbot组件模块,基于上述其他模块以外,整合 [simbot-core](../../UPDATE.MD) 并实现完整的simbot功能,面向bot应用开发者。


## ⚠️ 注意
目前的v3-api模块较为完整可用,其他模块在 `simbot-3.x` 问世之前将不会大幅度更新。
且在 `simbot-3.x` 问世前,开黑啦组件下的各模块不会发布**正式版本**

不过对于例如 `v3-api` 这种与simbot无关的api模块,你依然可以使用,并欢迎提供反馈与建议。


<br>

## 使用
Expand All @@ -95,100 +102,32 @@

TODO

## Demo

TODO

## 简单示例

### API-V3
API组件中,提供了针对于官方的大部分客户端请求API的基础封装,比如:
```kotlin
@Test
fun listTest() = runBlocking {
val guildId = "6865507942900765" // GuildApiTest().guildList().items[0].id

val client = HttpClient() // ktor client
val token = "token"

## 极简示例
val data: ListResp<ChannelInfo, ApiData.Resp.EmptySort> = ChannelListReq(guildId).doRequest(V3, client, token)

文档-快速开始:https://www.yuque.com/simpler-robot/simpler-robot-doc/qeyorq
println(data)

println("-0-")

### 监听消息

```java
@Beans
public class TestListener {
/** 发送一句“我收到了”,并再复读收到的所有消息 */
@OnPrivate
public void listen(PrivateMsg msg, MsgSender sender) {
sender.SENDER.sendPrivateMsg(msg, "我收到了");
sender.SENDER.sendPrivateMsg(msg, msg.getMsgContent());
}
}
```

### 监听并筛选消息

```java
@Beans
public class TestListener {
/** 监听群里的 'hi! simbot' 消息并作出回应 */
@OnGroup
@Filter("hi! simbot")
public void listenGroup(GroupMsg msg, MsgSender sender) {
// 获取发消息的人的账号
String accountCode = m.getAccountInfo().getAccountCode();
// 准备at这个人的CatCode
String at = CatCodeUtil.INSTANCE.getStringTemplate().at(accountCode);
// 发送消息
sender.SENDER.sendGroupMsg(m, at + " 我在哦");
}
}
data.forEach { it: ChannelInfo ->
println(it)
}
}
```
其中,`ChannelListReq` 即为对于 `/channel/list` 接口的封装。
所有的api请求实例均为此类的命名方式。


```java
@Beans
public class TestListener {
/** 通过依赖注入得到消息构建器工厂。 */
@Depend
private MessageContentBuilderFactory builderFactory;

/** 监听群里的 'hi! simbot' 消息并作出回应 */
@OnGroup
@Filter("hi! simbot")
public void listenGroup(GroupMsg msg, MsgSender sender){
// 获取发消息的人的账号
String accountCode = msg.getAccountInfo().getAccountCode();
// 获取消息构建器
MessageContentBuilder builder = builderFactory.getMessageContentBuilder();
// 构建消息实例
MessageContent msgContent = builder.at(accountCode).text(" 我在哦").build();
// 发送消息
sender.SENDER.sendGroupMsg(msg, msgContent);
}
}
```


## 协助我
- 你可以通过 [pr](https://github.com/ForteScarlet/simpler-robot/pulls "pull request") 为项目代码作出贡献。
- 你可以通过 [issue](https://github.com/ForteScarlet/simpler-robot/issues "issues") 提出一个建议或者反馈一个问题。
- 你可以通过 [讨论区](https://github.com/ForteScarlet/simpler-robot/discussions "discussions") 与其他人或者simbot开发团队相互友好交流。
- 如果你通过此项目创建了一个很酷的项目,欢迎通过 [issue](https://github.com/ForteScarlet/simpler-robot/issues)[讨论区](https://github.com/ForteScarlet/simpler-robot/discussions)[QQ群寻找群主](https://jq.qq.com/?_wv=1027&k=1Lopqryf)
等方式联系团队开发人员,并将你酷酷的项目展示在作品展示区。


## 捐助我
如果你喜欢这个项目,不妨试着 [捐助](https://www.yuque.com/docs/share/43264d27-99a7-4287-97c0-b387f5b0947e) 一下我们,十分感谢。


## 特别鸣谢

[![](https://logonoid.com/images/thumbs/intellij-idea-logo.png "IntelliJ IDEA")](https://www.jetbrains.com/idea/)

感谢 [jetbrains](https://www.jetbrains.com/ "jetbrains") 为团队提供的免费 [IntelliJ IDEA](https://www.jetbrains.com/idea/ "IntelliJ IDEA") 授权,也希望大家能够支持IDEA,支持正版。

*****

[![](../../logo/CatCodeLogo@0,1x.png "CatCode")](https://github.com/ForteScarlet/CatCode)

感谢 [猫猫码](https://github.com/ForteScarlet/CatCode "CatCode") 为本项目提供支持并绘制项目LOGO。


在得到 `xxxReq` 实例后,可以通过顶层函数 `xxxReq.doRequest(client, token)` 发送api请求,并得到响应值。
列表类型的响应值类型如上面所示,是一个 `ListResp<DATA, SORT>` 实例。其中,`DATA` 便是每个元素的实例,`SORT` 则为排序参数的响应(如果有的话)。

Original file line number Diff line number Diff line change
@@ -1,50 +1,55 @@
// /*
// *
// * * Copyright (c) 2021. ForteScarlet All rights reserved.
// * * Project simple-robot
// * * File MiraiAvatar.kt
// * *
// * * You can contact the author through the following channels:
// * * github https://github.com/ForteScarlet
// * * gitee https://gitee.com/ForteScarlet
// * * email [email protected]
// * * QQ 1149159218
// *
// */
//
// package love.test.channel
//
// import kotlinx.coroutines.runBlocking
// import love.forte.simbot.kaiheila.api.doRequest
// import love.forte.simbot.kaiheila.api.v3.V3
// import love.forte.simbot.kaiheila.api.v3.channel.ChannelListReq
// import love.test.GatewayApiConstant
// import love.test.client
// import kotlin.test.Test
//
//
// /**
// *
// * @author ForteScarlet
// */
// class ChannelListTest {
//
//
// @Test
// fun listTest() = runBlocking {
// val guildId = "6865507942900765" // GuildApiTest().guildList().items[0].id
//
// val data = ChannelListReq(guildId).doRequest(V3, client, GatewayApiConstant.token).data
//
// println(data)
//
// println("-0-")
//
// data.forEach {
// println(it)
// }
//
//
// }
//
// }
/*
*
* * Copyright (c) 2021. ForteScarlet All rights reserved.
* * Project simple-robot
* * File MiraiAvatar.kt
* *
* * You can contact the author through the following channels:
* * github https://github.com/ForteScarlet
* * gitee https://gitee.com/ForteScarlet
* * email [email protected]
* * QQ 1149159218
*
*/

package love.test.channel

import io.ktor.client.*
import kotlinx.coroutines.runBlocking
import love.forte.simbot.kaiheila.api.ApiData
import love.forte.simbot.kaiheila.api.ListResp
import love.forte.simbot.kaiheila.api.doRequest
import love.forte.simbot.kaiheila.api.v3.V3
import love.forte.simbot.kaiheila.api.v3.channel.ChannelInfo
import love.forte.simbot.kaiheila.api.v3.channel.ChannelListReq
import kotlin.test.Test


/**
*
* @author ForteScarlet
*/
class ChannelListTest {


@Test
fun listTest() = runBlocking {
val guildId = "6865507942900765" // GuildApiTest().guildList().items[0].id

val client = HttpClient() // ktor client
val token = "token"

val data: ListResp<ChannelInfo, ApiData.Resp.EmptySort> = ChannelListReq(guildId).doRequest(V3, client, token)

println(data)

println("-0-")

data.forEach { it: ChannelInfo ->
println(it)
}


}

}
2 changes: 1 addition & 1 deletion component/component-kaiheila-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>component-parent</artifactId>
<groupId>love.forte.simple-robot</groupId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion component/component-lovelycat-httpapi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>component-parent</artifactId>
<groupId>love.forte.simple-robot</groupId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion component/component-mirai/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>love.forte.simple-robot</groupId>
<artifactId>component-parent</artifactId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion component/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>project</artifactId>
<groupId>love.forte.simple-robot</groupId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion core-api/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>project</artifactId>
<groupId>love.forte.simple-robot</groupId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion core-api/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>project</artifactId>
<groupId>love.forte.simple-robot</groupId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion http/client-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>http-parent</artifactId>
<groupId>love.forte.simple-robot.http</groupId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion http/client-ktor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>http-parent</artifactId>
<groupId>love.forte.simple-robot.http</groupId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion http/client-restTemplate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>http-parent</artifactId>
<groupId>love.forte.simple-robot.http</groupId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>project</artifactId>
<groupId>love.forte.simple-robot</groupId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
4 changes: 2 additions & 2 deletions parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>love.forte.simple-robot</groupId>
<artifactId>parent</artifactId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<packaging>pom</packaging>

<modules>
Expand All @@ -23,7 +23,7 @@
<description>simple-robot是一个通用bot开发框架,以同一种灵活的标准来编写不同平台的bot应用。而simpler-robot便是simple-robot 2.x版本命名。</description>

<properties>
<simbot.version>2.3.0-BETA.6<!--v--></simbot.version>
<simbot.version>2.3.0<!--v--></simbot.version>
<simbot.khl.version>0.0.1-ALPHA.1<!--khlv--></simbot.khl.version>

<maven.compiler.source>8</maven.compiler.source>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>love.forte.simple-robot</groupId>
<artifactId>parent</artifactId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<relativePath>./parent/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion serialization/json-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>serialization-parent</artifactId>
<groupId>love.forte.simple-robot.serialization</groupId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion serialization/json-fastjson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>serialization-parent</artifactId>
<groupId>love.forte.simple-robot.serialization</groupId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion serialization/json-jackson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>serialization-parent</artifactId>
<groupId>love.forte.simple-robot.serialization</groupId>
<version>2.3.0-BETA.6<!--v--></version>
<version>2.3.0<!--v--></version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Loading

0 comments on commit 48aec73

Please sign in to comment.