Skip to content

Commit

Permalink
examples badge
Browse files Browse the repository at this point in the history
  • Loading branch information
wiz0u committed Jul 26, 2024
1 parent 1f529f7 commit b29e98d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/3/updates/polling.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Long Polling is done by calling [getUpdates](https://core.telegram.org/bots/api#
With our library, this can be done in one of three ways:

## By setting `bot.OnUpdate` (and/or `bot.OnMessage`)
[![Console application](https://img.shields.io/badge/Examples-Console-green?style=flat-square)](https://github.com/TelegramBots/Telegram.Bot.Examples/tree/master/Console)

Setting those events will automatically start a background polling system which will call your events accordingly:
- `OnMessage` for updates about messages (new or edited Message, Channel Post or Business Messages)
Expand All @@ -13,9 +14,10 @@ Setting those events will automatically start a background polling system which
> [!NOTE]
> If you don't set OnMessage, the OnUpdate event will be triggered for all updates, including messages.
## By using the `StartReceiving` method
## By using the `StartReceiving` method (or `ReceiveAsync`)
[![Advanced console application](https://img.shields.io/badge/Examples-Console.Advanced-green?style=flat-square)](https://github.com/TelegramBots/Telegram.Bot.Examples/tree/master/Console.Advanced)

This method will start a background polling system which will call your method on incoming updates.
Those methods start a polling system which will call your method on incoming updates.

As arguments, you can pass either lambdas, methods or a class derived from `IUpdateHandler` that implements the handling of Update and Error.

Expand Down
4 changes: 2 additions & 2 deletions src/3/updates/webhook.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Webhooks

[![Webhook guide](https://img.shields.io/badge/Bot_API-Webhook%20guide-blue.svg?style=flat-square)](https://core.telegram.org/bots/webhooks)
[![ASP.NET example with Controllers](https://img.shields.io/badge/Examples-Webhook.Controllers-green?style=flat-square)](https://github.com/TelegramBots/Telegram.Bot.Examples/tree/master/Webhook.Controllers)
[![ASP.NET example with Minimal APIs](https://img.shields.io/badge/Examples-Webhook.MinimalAPIs-green?style=flat-square)](https://github.com/TelegramBots/Telegram.Bot.Examples/tree/master/Webhook.MinimalAPIs)

With Webhook, your application gets notified automatically by Telegram when new updates arrive for your bot.

Expand All @@ -11,6 +9,7 @@ Your application will receive HTTP POST requests with an Update structure in the
Below, you will find how to configure an **ASP.NET Core Web API** project to make it work with Telegram.Bot, either with Controllers or Minimal APIs

## ASP.NET Core with Controllers (MVC)
[![ASP.NET example with Controllers](https://img.shields.io/badge/Examples-Webhook.Controllers-green?style=flat-square)](https://github.com/TelegramBots/Telegram.Bot.Examples/tree/master/Webhook.Controllers)

First you need to configure your Web App startup code:
- Locate the line `services.AddControllers();` _(in Program.cs or Startup.cs)_
Expand All @@ -35,6 +34,7 @@ public async Task HandleUpdate([FromBody] Update update)
Good, now skip to [SetWebHookAsync](#setwebhookasync) below

## ASP.NET Core with Minimal APIs
[![ASP.NET example with Minimal APIs](https://img.shields.io/badge/Examples-Webhook.MinimalAPIs-green?style=flat-square)](https://github.com/TelegramBots/Telegram.Bot.Examples/tree/master/Webhook.MinimalAPIs)

First you need to configure your Web App startup code:
- Locate the line `builder.Build();` _(in Program.cs)_
Expand Down

0 comments on commit b29e98d

Please sign in to comment.