Skip to content
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

Added STJ info #100

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);`
Loading