Skip to content

Commit

Permalink
Update README and doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ForteScarlet committed Jun 9, 2024
1 parent 1a56c9f commit 96cf616
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 26 deletions.
60 changes: 39 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,27 +286,45 @@ public class MyApp {

## 事件监听

目前可监听到的**组件事件**

- `OneBotMessageEvent` 消息事件
- `OneBotGroupMessageEvent` 群消息事件
- `OneBotNormalGroupMessageEvent` 普通群消息事件
- `OneBotAnonymousGroupMessageEvent` 匿名群消息事件
- `OneBotNoticeGroupMessageEvent` 群系统通知消息事件
- `OneBotPrivateMessageEvent` 私聊消息事件
- `OneBotFriendMessageEvent` 好友私聊消息事件
- `OneBotGroupPrivateMessageEvent` 群成员临时会话私聊事件
- `OneBotMetaEvent` 元事件
- `OneBotLifecycleEvent` 生命周期事件
- `OneBotHeartbeatEvent` 心跳事件
- `OneBotRequestEvent` 请求事件
- `OneBotFriendRequestEvent` 好友添加请求事件
- `OneBotGroupRequestEvent` 群添加请求事件
- `OneBotUnknownEvent` 未知事件
- `OneBotUnsupportedEvent` 未支持事件
- `OneBotBotStageEvent` 组件内Bot阶段事件
- `OneBotBotRegisteredEvent` Bot被注册了事件
- `OneBotBotStartedEvent` Bot被(首次)启动了事件
简单列举一下原始事件与可能对应的组件事件之间的关系。

| 原始事件 | 组件事件 |
|-----------------------------------------------|----------------------------------------|
| `MetaEvent` | `OneBotMetaEvent` |
| > `LifecycleEvent` | > `OneBotLifecycleEvent` |
| > `HeartbeatEvent` | > `OneBotHeartbeatEvent` |
| `MessageEvent` | `OneBotMessageEvent` |
| > `GroupMessageEvent` | > `OneBotGroupMessageEvent` |
| > `GroupMessageEvent` | > > `OneBotNormalGroupMessageEvent` |
| > `GroupMessageEvent` | > > `OneBotAnonymousGroupMessageEvent` |
| > `GroupMessageEvent` | > > `OneBotNoticeGroupMessageEvent` |
| > `PrivateMessageEvent` | > `OneBotPrivateMessageEvent` |
| > `PrivateMessageEvent` | > > `OneBotFriendMessageEvent` |
| > `PrivateMessageEvent` | > > `OneBotGroupPrivateMessageEvent` |
| `RequestEvent` | `OneBotRequestEvent` |
| > `FriendRequestEvent` | > `OneBotFriendRequestEvent` |
| > `GroupRequestEvent` | > `OneBotGroupRequestEvent` |
| `NoticeEvent` | `OneBotNoticeEvent` |
| > `FriendAddEvent` | > `OneBotFriendAddEvent` |
| > `FriendRecallEvent` | > `OneBotFriendRecallEvent` |
| > `GroupAdminEvent` | > `OneBotGroupAdminEvent` |
| > `GroupBanEvent` | > `OneBotGroupBanEvent` |
| > `GroupIncreaseEvent``GroupDecreaseEvent` | > `OneBotGroupChangeEvent` |
| > `GroupIncreaseEvent` | > > `OneBotGroupMemberIncreaseEvent` |
| > `GroupDecreaseEvent` | > > `OneBotGroupMemberDecreaseEvent` |
| > `GroupRecallEvent` | > `OneBotGroupRecallEvent` |
| > `GroupUploadEvent` | > `OneBotGroupUploadEvent` |
| > `NotifyEvent` | > `OneBotNotifyEvent` |
| > `NotifyEvent` | > > `OneBotHonorEvent` |
| > `NotifyEvent` | > > `OneBotLuckyKingEvent` |
| > `NotifyEvent` | > > `OneBotPokeEvent` |
| > `NotifyEvent` | > > > `OneBotMemberPokeEvent` |
| > `NotifyEvent` | > > > `OneBotBotSelfPokeEvent` |
| `UnknownEvent` | > `UnknownEvent` |
|| `OneBotBotStageEvent` |
|| > `OneBotBotRegisteredEvent` |
|| > `OneBotBotStartedEvent` |
| 任意未支持事件 | `OneBotUnsupportedEvent` |

其中,可以通过 `OneBotUnsupportedEvent``OneBotUnknownEvent`
来间接地监听那些尚未提供组件事件类型的原始事件。
Expand Down
68 changes: 63 additions & 5 deletions Writerside/topics/Event.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

一个特殊的事件类型。
它是当遇到无法被上述这些类型所解析时使用的兜底类型,
它不可序列化,除 `time``selfId``postType`
它不可序列化,除 `time``selfId``postType`
之外直接提供 `raw` 属性(也就是原始的JSON字符串)。

</def>
Expand All @@ -53,8 +53,6 @@
组件实现是基于simbot标准API中定义的事件类型、对上述**原始事件**的包装,
并提供相对应的功能性API实现。

### 消息事件

<deflist>
<def id="OneBotMessageEvent" title="OneBotMessageEvent">
与消息相关的事件。
Expand Down Expand Up @@ -114,7 +112,26 @@
</def>
</deflist>
</def>

<def id="OneBotNoticeEvent" title="OneBotNoticeEvent">
通知相关的事件。
<deflist>
<def id="OneBotFriendAddEvent" title="OneBotFriendAddEvent">好友已添加事件</def>
<def id="OneBotFriendRecallEvent" title="OneBotFriendRecallEvent">好友消息撤回事件</def>
<def id="OneBotGroupAdminEvent" title="OneBotGroupAdminEvent">管理员变动事件</def>
<def id="OneBotGroupBanEvent" title="OneBotGroupBanEvent">群禁言事件</def>
<def id="OneBotGroupChangeEvent" title="OneBotGroupChangeEvent">群成员变动事件</def>
<def id="OneBotGroupMemberIncreaseEvent" title="OneBotGroupMemberIncreaseEvent">群成员添加事件</def>
<def id="OneBotGroupMemberDecreaseEvent" title="OneBotGroupMemberDecreaseEvent">群成员离开事件</def>
<def id="OneBotGroupRecallEvent" title="OneBotGroupRecallEvent">群消息撤回事件</def>
<def id="OneBotGroupUploadEvent" title="OneBotGroupUploadEvent">群文件上传事件</def>
<def id="OneBotNotifyEvent" title="OneBotNotifyEvent">群荣耀事件、红包人气王事件或戳一戳事件</def>
<def id="OneBotHonorEvent" title="OneBotHonorEvent">群荣耀事件</def>
<def id="OneBotLuckyKingEvent" title="OneBotLuckyKingEvent">红包人气王事件</def>
<def id="OneBotPokeEvent" title="OneBotPokeEvent">戳一戳事件</def>
<def id="OneBotMemberPokeEvent" title="OneBotMemberPokeEvent">戳一戳(普通群成员被戳)事件</def>
<def id="OneBotBotSelfPokeEvent" title="OneBotBotSelfPokeEvent">戳一戳(Bot被戳)事件</def>
</deflist>
</def>

<def id="OneBotBotStageEvent" title="OneBotBotStageEvent">
与OneBot协议本身无关的Bot的阶段事件。
Expand All @@ -129,7 +146,6 @@
</def>
</deflist>


### 未知事件

`OneBotUnknownEvent`
Expand All @@ -144,3 +160,45 @@
但是尚未提供对应的**组件事件**实现的事件类型时用来兜底的类型。

这些原始事件类型会被统一装入此事件中。

## 事件关系

简单列举一下原始事件与可能对应的组件事件之间的关系。

| 原始事件 | 组件事件 |
|-----------------------------------------------|----------------------------------------|
| `MetaEvent` | `OneBotMetaEvent` |
| > `LifecycleEvent` | > `OneBotLifecycleEvent` |
| > `HeartbeatEvent` | > `OneBotHeartbeatEvent` |
| `MessageEvent` | `OneBotMessageEvent` |
| > `GroupMessageEvent` | > `OneBotGroupMessageEvent` |
| > `GroupMessageEvent` | > > `OneBotNormalGroupMessageEvent` |
| > `GroupMessageEvent` | > > `OneBotAnonymousGroupMessageEvent` |
| > `GroupMessageEvent` | > > `OneBotNoticeGroupMessageEvent` |
| > `PrivateMessageEvent` | > `OneBotPrivateMessageEvent` |
| > `PrivateMessageEvent` | > > `OneBotFriendMessageEvent` |
| > `PrivateMessageEvent` | > > `OneBotGroupPrivateMessageEvent` |
| `RequestEvent` | `OneBotRequestEvent` |
| > `FriendRequestEvent` | > `OneBotFriendRequestEvent` |
| > `GroupRequestEvent` | > `OneBotGroupRequestEvent` |
| `NoticeEvent` | `OneBotNoticeEvent` |
| > `FriendAddEvent` | > `OneBotFriendAddEvent` |
| > `FriendRecallEvent` | > `OneBotFriendRecallEvent` |
| > `GroupAdminEvent` | > `OneBotGroupAdminEvent` |
| > `GroupBanEvent` | > `OneBotGroupBanEvent` |
| > `GroupIncreaseEvent``GroupDecreaseEvent` | > `OneBotGroupChangeEvent` |
| > `GroupIncreaseEvent` | > > `OneBotGroupMemberIncreaseEvent` |
| > `GroupDecreaseEvent` | > > `OneBotGroupMemberDecreaseEvent` |
| > `GroupRecallEvent` | > `OneBotGroupRecallEvent` |
| > `GroupUploadEvent` | > `OneBotGroupUploadEvent` |
| > `NotifyEvent` | > `OneBotNotifyEvent` |
| > `NotifyEvent` | > > `OneBotHonorEvent` |
| > `NotifyEvent` | > > `OneBotLuckyKingEvent` |
| > `NotifyEvent` | > > `OneBotPokeEvent` |
| > `NotifyEvent` | > > > `OneBotMemberPokeEvent` |
| > `NotifyEvent` | > > > `OneBotBotSelfPokeEvent` |
| `UnknownEvent` | > `UnknownEvent` |
|| `OneBotBotStageEvent` |
|| > `OneBotBotRegisteredEvent` |
|| > `OneBotBotStartedEvent` |
| 任意未支持事件 | `OneBotUnsupportedEvent` |
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ import love.forte.simbot.suspendrunner.STP
*
* @see GroupMessageEvent
*
* @see OneBotNormalGroupMessageEvent
* @see OneBotAnonymousGroupMessageEvent
* @see OneBotNoticeGroupMessageEvent
*
* @author ForteScarlet
*/
@STP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import love.forte.simbot.suspendrunner.STP
* [私聊消息事件](https://github.com/botuniverse/onebot-11/blob/master/event/message.md#私聊消息)
*
* @see PrivateMessageEvent
* @see OneBotFriendMessageEvent
* @see OneBotGroupPrivateMessageEvent
*
* @author ForteScarlet
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public typealias OBSourceRequestEvent = love.forte.simbot.component.onebot.v11.e
* OneBot组件中的 [事件请求][love.forte.simbot.component.onebot.v11.event.request.RequestEvent]
* 的组件事件类型。
*
* @see love.forte.simbot.component.onebot.v11.event.request.RequestEvent
* @see OneBotFriendRequestEvent
* @see OneBotGroupRequestEvent
*
* @author ForteScarlet
*/
public interface OneBotRequestEvent : OneBotBotEvent, RequestEvent {
Expand Down

0 comments on commit 96cf616

Please sign in to comment.