Skip to content

Commit

Permalink
Added STJ info
Browse files Browse the repository at this point in the history
  • Loading branch information
wiz0u committed Jun 24, 2024
1 parent ae30e02 commit 7420b28
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ Check the `UpdateType` of the `Update`. If it is `UpdateType.ChannelPost` then t

## I have serialization issues or null values in `Update` object in my webhook. What do I do?

If you're using ASP.NET Core 3.0+ you need to install additional Nuget package: [Microsoft.AspNetCore.Mvc.NewtonsoftJson](https://www.nuget.org/packages/Microsoft.AspNetCore.Mvc.NewtonsoftJson/). For more information read [this page](https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.1&tabs=visual-studio#use-newtonsoftjson-in-an-aspnet-core-30-mvc-project) about migrating from previous versions of ASP.NET Core.
If you're using ASP.NET Core 3.0+ you need to configure System.Text.Json options to work correctly with Telegram.Bot

See [this page for instructions](Migration-Guide-to-Version-21.x.md#webhooks-with-systemtextjson).

## Is there a way to get a list of users in a group or a channel?

Expand Down
10 changes: 10 additions & 0 deletions src/Migration-Guide-to-Version-21.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,13 @@ To make a payment in [Telegram Stars](https://t.me/BotNews/90) with SendInvoiceA
- `prices:` with a single price
- no tip amounts

## Webhooks with System.Text.Json

The library now uses `System.Text.Json` instead of `NewtonsoftJson`.

To make it work in your ASP.NET projects, you'll need to:
- Remove package **Microsoft.AspNetCore.Mvc.NewtonsoftJson** from your project dependencies
- Configure your webapp services in your Startup with
`services.ConfigureTelegramBot<Microsoft.AspNetCore.Mvc.JsonOptions>(opt => opt.JsonSerializerOptions);`
- or if you use minimal APIs, use this line instead:
`builder.Services.ConfigureTelegramBot<Microsoft.AspNetCore.Http.Json.JsonOptions>(opt => opt.SerializerOptions);`

0 comments on commit 7420b28

Please sign in to comment.