Skip to content

Commit

Permalink
Bumps into v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gehongyan committed May 21, 2023
1 parent 7f03741 commit 4841314
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 1 deletion.
90 changes: 90 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,96 @@

---

## v0.5.0 [2023-05-21]

### Update Path

For the sake of convenience, this version has made adjustments to the parameter types passed in some events
in `BaseSocketClient`. Please refer to the appendix at the end of the document for specific changes to event parameters.
Applications involving these events need to be updated accordingly.

The enum values and properties representing key accounts in `GuildFeature` and `GuildFeatures` have been renamed
for more accurate naming. `GuildPermissions` has been refactored as a struct, and the type of
the `RoleProperties.Permissions` property has been changed accordingly. The type of `RestGuild.Channels` was incorrectly
declared as a dictionary with values of type `RestChannel`, and has been corrected to a dictionary with values of
type `RestGuildChannel`. The return type of some methods on `KookSocketClient` was previously `ValueTask`, but has now
been unified to `Task`. Usages involving these APIs need to be updated accordingly.

### Added

- Added `GuildFeature.Partner` enum value and `GuildFeatures.IsPartner` property.
- Added `IGuild.Banner` property.
- Added `CurrentUserNickname`, `CurrentUserDisplayName`, and `CurrentUserRoles` properties on `RestGuild`.
- Added `SyncPermissionsAsync` method on `INestedChannel`.
- Added `DownloadVoiceStatesAsync` and `DownloadBoostSubscriptionsAsync` abstract methods on `BaseSocketClient`.
- Added `TextChannels`, `VoiceChannels`, and `CategoryChannels` properties on `RestGuild`.

### Changed
.
- Renamed `GuildFeature.Ka` to `GuildFeature.KeyAccount` and `GuildFeatures.IsKa` to `GuildFeatures.IsKeyAccount`.
- Changed `GuildPermissions` to a struct and changed `RoleProperties.Permissions` to type `GuildPermissions?`.
- For convenience, some events in `BaseSocketClient` have been changed or added with event parameters. See the appendix
at the end of the document for details..
- Changed all parameters of `DownloadBoostSubscriptionsAsync` method on `BaseSocketClient` to optional parameters.
- Changed the type of `RestGuild.Channels` to `ImmutableDictionary<ulong, RestGuildChannel>`.
- Changed the return type of `GetChannelAsync`, `GetDMChannelAsync`, `GetDMChannelsAsync`, and `GetUserAsync` methods
on `KookSocketClient` to `Task<*>`.

### Fixed

- Fixed an issue where some APIs were unable to correctly parse the string `1` or `0` when returning a bool type.
- Fixed an issue where `IGuild.DefaultChannelId` was not correctly set to the actual default text channel configured on
the server.
- Fixed an issue where `SocketGuild.CurrentUser` was null when downloading the server user list.
- Fixed an issue where `IsOnline` and `ActiveClient` on `SocketUser` could throw null reference exceptions.
- Fixed an issue where messages of type `MessageType.Poke` were not correctly parsed.
- Fixed an issue where the request bucket was not handling HTTP 429 Too Many Requests errors correctly.

### Optimized

- Optimized the debugger display text of `Cacheable`.
- `FileAttachment.Stream` can now be reused.
- The `SendFileAsync` and `ReplyFileAsync` methods will now cache the asset URI created for `FileAttachment` attachments
created through files or streams before multiple sends, to avoid uploading the same file repeatedly.

### Misc

- Fixed some strange code indentation.
- Changed the document theme.
- Added a separate workflow for updating the documentation that depends on the `doc` branch.
- Added an API quick reference document.
- Added missing permission values to permission-related unit tests.

### Appendix

Event parameter changes in `BaseSocketClient`:

- `ReactionAdded` and `ReactionRemoved`
- `ISocketMessageChannel``SocketTextChannel`
- Add `Cacheable<SocketGuildUser, ulong>` representing the user who added or removed the reaction

- `DirectReactionAdded` and `DirectReactionRemoved`
- Add `Cacheable<SocketUser, ulong>` representing the user who added or removed the reaction

- `MessageReceived`
- Add `SocketGuildUser` representing the user who sent the message
- Add `SocketTextChannel` representing the text channel where the message was sent

- `MessageDeleted``MessageUpdated``MessagePinned``MessageUnpinned`
- `ISocketMessageChannel``SocketTextChannel`

- `DirectMessageReceived`
- Add `SocketUser` representing the user who sent the message
- Add `SocketDMChannel`representing the DM channel where the message was sent

- `DirectMessageDeleted`
- `Cacheable<IDMChannel, Guid>``Cacheable<SocketDMChannel, ulong>`
- Add `Cacheable<SocketUser, ulong>` representing the user who sent the message

- `DirectMessageUpdated`
- `IDMChannel``Cacheable<SocketDMChannel, ulong>`
- Add `Cacheable<SocketUser, ulong>` representing the user who sent the message

## v0.4.1 [2023-04-05]

### Fixed
Expand Down
85 changes: 85 additions & 0 deletions docs/changelog/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,91 @@ title: 变更日志

# 变更日志

## v0.5.0 [2023-05-21]

### 更新路线

出于便利性原因,此版本对 `BaseSocketClient` 中的部分事件所传递的参数类型进行了调整,事件参数所发生的具体变更可参阅文末的附录,
对涉及到的事件的应用都需要进行相应的更新。

`GuildFeature``GuildFeatures` 中表示重要客户的枚举值与属性已被重命名为更准确的名称;`GuildPermissions`
已被重构为结构体,`RoleProperties.Permissions` 属性的类型也已被相应变更;`RestGuild.Channels`
的类型被错误地声明为值的类型为 `RestChannel` 的字典,已被修正为值的类型为 `RestGuildChannel` 的字典;`KookSocketClient`
上的部分方法的返回类型为 `ValueTask`,现已统一为 `Task`。涉及到以上 `API` 的用法都需要进行相应的更新。

### 新增

- 新增 `GuildFeature.Partner` 枚举值及 `GuildFeatures.IsPartner` 属性
- 新增 `IGuild.Banner` 属性
- 新增 `RestGuild` 上的 `CurrentUserNickname``CurrentUserDisplayName``CurrentUserRoles` 属性
- 新增 `INestedChannel.SyncPermissionsAsync` 方法
- 新增 `BaseSocketClient` 上的 `DownloadVoiceStatesAsync``DownloadBoostSubscriptionsAsync` 抽象方法
- 新增 `RestGuild` 上的 `TextChannels``VoiceChannels``CategoryChannels` 属性

### 变更

- 重命名 `GuildFeature.Ka``GuildFeature.KeyAccount``GuildFeatures.IsKa``GuildFeatures.IsKeyAccount`
- 变更 `GuildPermissions` 为结构体,变更 `RoleProperties.Permissions``GuildPermissions?` 类型
- 出于便利性目的,为部分 `BaseSocketClient` 中的事件变更或新增了事件参数,变更详情参见文末的附录
- 变更 `BaseSocketClient` 上的 `DownloadBoostSubscriptionsAsync` 方法参数都为可选参数
- 变更 `RestGuild.Channels` 的类型为 `ImmutableDictionary<ulong, RestGuildChannel>`
- 变更 `KookSocketClient` 上的 `GetChannelAsync``GetDMChannelAsync``GetDMChannelsAsync``GetUserAsync`
的方法返回类型为 `Task<*>`

### 修复

- 修复部分 API 对 bool 类型返回字符串 `1``0` 时未能正确解析的问题
- 修复 `IGuild.DefaultChannelId` 未能正确设置为服务器实际配置的默认文字频道的问题
- 修复为下载服务器用户列表时 `SocketGuild.CurrentUser``null` 的问题
- 修复 `SocketUser` 上的 `IsOnline``ActiveClient` 可能会抛出空引用异常的问题
- 修复 `MessageType.Poke` 类型的消息未被正确解析的问题
- 修复请求桶未能对 HTTP 429 Too Many Requests 错误进行正确处理的问题

### 优化

- 优化 `Cacheable` 的调试器显示文本
- `FileAttachment.Stream` 现已可以复用
- `SendFileAsync``ReplyFileAsync` 方法对通过文件或流创建的 `FileAttachment`
附件进行多次发送前所创建的资产地址将会被缓存,以避免重复上传相同的文件

### 其它

- 修正了一些奇怪的代码缩进
- 变更文档主题
- 新增依赖于 doc 分支的文档更新独立工作流
- 新增 API 快速参考文档
- 补充权限相关单元测试中缺失的权限值

### 附录

**`BaseSocketClient` 中变更参数的事件列表:**

`ReactionAdded``ReactionRemoved`
- `ISocketMessageChannel``SocketTextChannel`
- 新增 `Cacheable<SocketGuildUser, ulong>` 参数表示添加或取消回应的服务器用户

`DirectReactionAdded``DirectReactionRemoved`
- 新增 `Cacheable<SocketUser, ulong>` 参数表示添加或取消回应的用户

`MessageReceived`
- 新增 `SocketGuildUser` 表示发送消息的服务器用户
- 新增 `SocketTextChannel` 表示消息所在的服务器文字频道

`MessageDeleted``MessageUpdated``MessagePinned``MessageUnpinned`
- `ISocketMessageChannel``SocketTextChannel`

`DirectMessageReceived`
- 新增 `SocketUser` 表示发送消息的用户
- 新增 `SocketDMChannel` 表示消息所在的私聊频道

`DirectMessageDeleted`
- `Cacheable<IDMChannel, Guid>``Cacheable<SocketDMChannel, ulong>`
- 新增 `Cacheable<SocketUser, ulong>` 表示消息的发送者

`DirectMessageUpdated`
- `IDMChannel``Cacheable<SocketDMChannel, ulong>`
- 新增 `Cacheable<SocketUser, ulong>` 表示消息的发送者

## v0.4.1 [2023-04-05]

### 修复
Expand Down
2 changes: 1 addition & 1 deletion src/Kook.Net.targets
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<VersionPrefix>0.4.1</VersionPrefix>
<VersionPrefix>0.5.0</VersionPrefix>
<!-- <VersionSuffix>rc</VersionSuffix>-->
<LangVersion>latest</LangVersion>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
Expand Down

0 comments on commit 4841314

Please sign in to comment.