mirror of
https://github.com/yawaflua/Telegram.Net.git
synced 2025-12-10 04:29:28 +02:00
Fix error with broken dependencies.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Telegram.Bot;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Net.Attributes;
|
||||
using Telegram.Net.Interfaces;
|
||||
@@ -7,6 +8,11 @@ namespace Telegram.Examples.UpdatePolling;
|
||||
|
||||
public class Update : IUpdatePollingService
|
||||
{
|
||||
private static IConfiguration _conf;
|
||||
public Update(IConfiguration conf)
|
||||
{
|
||||
_conf = conf;
|
||||
}
|
||||
[Update]
|
||||
public async Task UpdateExample(ITelegramBotClient client, Bot.Types.Update update, CancellationToken ctx)
|
||||
{
|
||||
@@ -31,6 +37,12 @@ public class Update : IUpdatePollingService
|
||||
await client.SendMessage(message.From!.Id, "Hello, I`m example bot.", cancellationToken: ctx);
|
||||
}
|
||||
|
||||
[Command("/test_conf")]
|
||||
public async Task TestConfigurationBuilder(ITelegramBotClient client, Message message, CancellationToken cts)
|
||||
{
|
||||
await client.SendMessage(message.Chat.Id, _conf.GetValue<string>("ExampleMessage") ?? throw new Exception("Not found"));
|
||||
}
|
||||
|
||||
[EditMessage]
|
||||
public async Task EditMessageExmaple(ITelegramBotClient client, Message message, CancellationToken ctx)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user