-
Notifications
You must be signed in to change notification settings - Fork 10
Добавлен Payload в Update для поддержки deeplinks в соответствии с до… #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -90,6 +90,11 @@ public override Update Read(ref Utf8JsonReader reader, Type typeToConvert, JsonS | |
| update.IsMuted = isMutedElement.GetBoolean(); | ||
| } | ||
|
|
||
| if (root.TryGetProperty("payload", out var payload)) | ||
| { | ||
| update.Payload = payload.GetString(); | ||
| } | ||
|
Comment on lines
+93
to
+96
|
||
|
|
||
| return update; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,6 +59,12 @@ public class Update | |
| [JsonPropertyName("message")] | ||
| public Message? Message { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the payload | ||
| /// </summary> | ||
| [JsonPropertyName("payload")] | ||
| public string? Payload { get; set; } | ||
|
Comment on lines
+62
to
+66
|
||
|
|
||
| /// <summary> | ||
| /// Gets or sets the callback query in this update. | ||
| /// Present in: message_callback. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
payload.GetString()will throw if the API ever returns a non-string payload (object/number/etc.). Other converters in this repo (e.g., callback/button payload) defensively handle both string and non-string by usingValueKindand falling back toGetRawText(). Please align this parsing to avoid unexpected runtime exceptions.