FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Telegram.Bot.Examples/Webhook.Controllers/Program.cs at master · TelegramBots/Telegram.Bot.Examples · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
TelegramBots
/
Telegram.Bot.Examples
Public
Notifications
You must be signed in to change notification settings
Fork
298
Star
701
Code
Issues
2
Pull requests
0
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
Telegram.Bot.Examples
/
Webhook.Controllers
/
Program.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
25 lines (16 loc) · 742 Bytes
Breadcrumbs
Telegram.Bot.Examples
/
Webhook.Controllers
/
Program.cs
Copy path
File metadata and controls
25 lines (16 loc) · 742 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using
Telegram
.
Bot
;
using
Webhook
.
Controllers
;
var
builder
=
WebApplication
.
CreateBuilder
(
args
)
;
// Setup bot configuration
var
botConfigSection
=
builder
.
Configuration
.
GetSection
(
"BotConfiguration"
)
;
builder
.
Services
.
Configure
<
BotConfiguration
>
(
botConfigSection
)
;
builder
.
Services
.
AddHttpClient
(
"tgwebhook"
)
.
RemoveAllLoggers
(
)
.
AddTypedClient
<
ITelegramBotClient
>
(
httpClient
=>
new
TelegramBotClient
(
botConfigSection
.
Get
<
BotConfiguration
>
(
)
!
.
BotToken
,
httpClient
)
)
;
builder
.
Services
.
AddSingleton
<
Webhook
.
Controllers
.
Services
.
UpdateHandler
>
(
)
;
builder
.
Services
.
AddControllers
(
)
;
var
app
=
builder
.
Build
(
)
;
// Configure the HTTP request pipeline.
app
.
UseHttpsRedirection
(
)
;
app
.
UseAuthorization
(
)
;
app
.
MapControllers
(
)
;
app
.
Run
(
)
;
Back
|
FazBrowse Home
|
New Git URL