Skip to content

Commit

Permalink
Fix changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
gehongyan committed Apr 3, 2023
1 parent 63bb7e1 commit 682e2da
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 33 deletions.
71 changes: 39 additions & 32 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,85 +10,92 @@ Due to the following reasons, this version has made adjustments to the parameter
in `BaseSocketClient`:

- Some parameters are always present and do not need to be wrapped with `Cacheable`, such as `MessageDeleted`
and `UserConnected`;
and `UserConnected`.
- The data sent by the gateway is incomplete, resulting in missing parameters in some events. These event parameters
have been adjusted to entities wrapped with `Cacheable` to fix the issue of unknown entity IDs that cannot be obtained
through the REST client API request for complete data;
through the REST client API request for complete data.
- The original processing logic for incomplete data sent by the gateway was to obtain complete data by initiating API
requests through the REST client, which may cause performance issues or timeouts in large servers, such
as `GuildMemberOnline` and `GuildMemberOffline`. These event parameters have been adjusted to entities wrapped
with `Cacheable`, and can be obtained on demand through the `GetOrDownloadAsync` method;
with `Cacheable`, and can be obtained on demand through the `GetOrDownloadAsync` method.
- Some event parameters are too specific, resulting in a mismatch of types and passing empty values, such
as `ReactionAdded`;
as `ReactionAdded`.
- Some event parameters are too general, such as `MessageDeleted` and `UserConnected`, which can avoid unnecessary
pattern matching;
- Some event parameters are missing, such as `UserBanned`;
pattern matching.
- Some event parameters are missing, such as `UserBanned`.
- Some events pass excessively redundant parameters, such as `MessageButtonClicked`.
- The specific changes to the event parameters can be found in the appendix at the end of the document. All applications
involving these events need to be updated accordingly.

Full changes to the event parameters can be found in the appendix at the end of the document. All usages involving these
events need to be updated accordingly.

All formatting methods in the KMarkdown formatting helper class `Format` have been changed to extension methods, and a
new optional parameter sanitize has been added to support whether to escape special characters in the text, which
new optional parameter `sanitize` has been added to support whether to escape special characters in the text, which
defaults to true. The calling method of extension methods is still compatible with the original static method calling
method. By default, all formatting methods escape special characters in the text that conflict with KMarkdown syntax to
avoid syntax parsing errors. This feature is enabled by default and can be disabled through the sanitize parameter. If
the text parameter passed to this method has already escaped special characters, the sanitize parameter should be set to
false, or the input parameter should be adjusted to the original unescaped text.
avoid syntax parsing errors. This feature is enabled by default and can be disabled through the `sanitize` parameter. If
the text parameter passed to this method has already escaped special characters, the `sanitize` parameter should be set
to `false`, or the input parameter should be adjusted to the original unescaped text. Additionally, the logic of
the `Format.Quote` and `Format.BlockQuote` methods have been adjusted. They will now insert line breaks and zero-width
joiners (`\u200d`) as needed within the text to maintain the display effect in the KOOK client. The formatting result of
the `Format.BlockQuote` method guarantees that the entire text block will be displayed as one quoted block in the KOOK
client, while the formatting result of the `Format.Quote` method will split the text into multiple quoted blocks based
on empty lines, with the empty lines not included in the quoted blocks.

The `Parse` and `TryParse` methods in the `CardJsonExtension` class have been renamed to `ParseSingle`
and `TryParseSingle` to avoid conflicts with the `ParseMany` and `TryParseMany` methods used to parse multiple cards.
All calls involving this method need to be updated accordingly.
All calls involving these methods need to be updated accordingly.

The `Features` property type in `IGuild` and `IRecommendInfo` was originally `object[]`, and is now implemented as
the `GuildFeatures` type. All calls involving this property need to be updated accordingly.
the `GuildFeatures` type. All calls involving these properties need to be updated accordingly.

The `RestPresence` namespace has been corrected to `Kook.Rest`. All calls involving `RestPresence` need to update the
namespace reference accordingly.

### Added

- Added methods for managing friends and blocked users. For details, see the appendix at the end of the document.
- Added debug display text for the `Cacheable` and `Quote` classes
- Added debug display text for the `Cacheable` and `Quote` classes.
- Added `MaxJoinedGuildDataFetchingRetryTimes` and `JoinedGuildDataFetchingRetryDelay` properties to `KookSocketConfig`
for controlling the number of times and delay between retries for fetching data when joining a server
- Added `ParseMany` and `TryParseMany` methods to `CardJsonExtension`
- (Experimental feature) Added the `IVoiceRegion.MinimumBoostLevel` property
- (Experimental feature) Added `ValidateCardAsync` and `ValidateCardsAsync` methods to `KookRestClient`
for controlling the number of times and delay between retries for fetching data when joining a server.
- Added `ParseMany` and `TryParseMany` methods to `CardJsonExtension`.
- (Experimental feature) Added the `IVoiceRegion.MinimumBoostLevel` property.
- (Experimental feature) Added `ValidateCardAsync` and `ValidateCardsAsync` methods to `KookRestClient`.

### Changed

- Changed the parameter types for some events in `BaseSocketClient`. For details, see the appendix at the end of the
document.
- The formatting methods in the `Format` helper class have been changed to extension methods, and a new optional
sanitize parameter has been added to support escaping special characters in the text. The default value is true.
sanitize parameter has been added to support escaping special characters in the text. The default value is `true`.
- Renamed the `Parse` and `TryParse` methods in `CardJsonExtension` to `ParseSingle` and `TryParseSingle`.
- Implemented the `Features` property of `IGuild` and `IRecommendInfo` as the `GuildFeatures` type.
- Corrected the namespace for `RestPresence` to `Kook.Rest`.
- (Experimental feature) The `KookRestClient.GetAdminGuildsAsync` method now supports bot authentication.
- (Experimental feature) The `KookRestClient.GetAdminGuildsAsync` method now supports Bot authentication.

### Fixed

- Fixed an issue where the results of the `Format.Quote` and `Format.BlockQuote` methods were displayed incorrectly in
KOOK
- Fixed an issue where the error message displayed when `CountdownModuleBuilder.Build` throws an exception was incorrect
- Fixed an issue where `BaseSocketClient.DirectMessageUpdated` might pass an incorrect user entity
- Fixed an issue where the `Author` property was null in message-related events when the user was not cached
- Fixed an issue where `IGuild.OwnerId` was `0`
KOOK.
- Fixed an issue where the error message in exceptions thrown by `CountdownModuleBuilder.Build` was incorrect.
- Fixed an issue where `BaseSocketClient.DirectMessageUpdated` might pass an incorrect user entity.
- Fixed an issue where the `Author` property was null in message-related events when the user was not cached.
- Fixed an issue where `IGuild.OwnerId` is`0`.
- Fixed an issue where the `IsPinned` property was not set correctly in `BaseSocketClient.Pinned`
and `BaseSocketClient.Unpinned` events
- Fixed an issue where the `IPresence.ActiveClient` property could be unintentionally cleared
- Fixed an issue where the debug display format of `IPresence` was incorrect
and `BaseSocketClient.Unpinned` events.
- Fixed an issue where the `IPresence.ActiveClient` property could be unintentionally cleared.
- Fixed an issue where the debug display format of `IPresence` was incorrect.
- Fixed an issue where the default implementation of `IRestClient` could throw an exception when `DEBUG_REST`
preprocessor directive was enabled for debugging high-concurrency requests in the source code
preprocessor directive was enabled for debugging high-concurrency requests in the source code.
- Fixed an issue where `Quote.Empty` was not a static property.

### Optimized

- Fixed an issue with missing preprocessor directives in `KookRestApiClient`.
- Optimized the `SocketUser.UpdateIntimacyAsync` method's implementation of the `IUser` interface.
- Improved the use of `NumberBooleanConverter`.
- `KookSocketClient` logs the content of received packets when they are out of order or not handled correctly.
- When printing exception packets, `KookSocketClient` uses the passed-in serializerOptions serialization options.
- `KookSocketClient` logs warnings or the content of received packets when they are out of order or not handled
correctly.
- When printing exception packets, `KookSocketClient` uses the passed-in `serializerOptions` serialization options.
- Completed XML documentation for `BaseSocketClient` events.

### Misc
Expand Down
6 changes: 5 additions & 1 deletion docs/changelog/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ KMarkdown 格式化帮助类 `Format` 中的各格式化方法皆已变更为扩
`sanitize`,以支持是否对文本内的特殊字符进行转义,默认为 `true`。扩展方法的调用方式仍然兼容原有的静态方法调用方式。
默认情况下,各格式化方法会对文本内与 KMarkdown 语法冲突的特殊字符进行转义,以避免 KMarkdown 语法解析错误。
此特性默认启用,可通过 `sanitize` 参数禁用。所有涉及到传入此方法的文本参数如已对特殊字符进行转义,
则应将 `sanitize` 参数设置为 `false`,或调整传入参数为未转义的原始文本。
则应将 `sanitize` 参数设置为 `false`,或调整传入参数为未转义的原始文本。另外,`Format.Quote`
`Format.BlockQuote` 方法的逻辑已调整,现在会在文本内按需插入换行符与零宽连字符,以保持文本在 KOOK
客户端中的显示效果。其中,`Format.BlockQuote` 方法的格式化结果可以保证整段文本在 KOOK
客户端中的显示为一段引用块,而 `Format.Quote` 方法的格式化结果则将文本按空行分割为多个引用块,
空行不会包括在引用块内。

`CardJsonExtension` 类中的 `Parse``TryParse` 方法已重命名为 `ParseSingle``TryParseSingle`
以避免与解析多个卡片时使用的 `ParseMany``TryParseMany` 方法产生冲突。所有涉及到此方法的调用都需要进行相应的更新。
Expand Down

0 comments on commit 682e2da

Please sign in to comment.