fix: remove comments
This commit is contained in:
parent
37f987d244
commit
affae8ff48
@ -32,7 +32,7 @@ public class BotHandler
|
||||
{
|
||||
_logger.LogInformation("Starting bot...");
|
||||
_bot = new TelegramBotClient(_botConfiguration.Token, cancellationToken: cancellationToken);
|
||||
// var me = await _bot.GetMe();
|
||||
|
||||
|
||||
_bot.OnError += OnError;
|
||||
_bot.OnMessage += OnMessage;
|
||||
@ -69,11 +69,7 @@ public class BotHandler
|
||||
|
||||
await using var stream = File.OpenRead(@"C:\Users\GuillermoMarcel\Pictures\prueba.jpeg");
|
||||
var inputFile = InputFile.FromStream(stream, "gorda.jpeg");
|
||||
// var message = await _bot.SendPhotoAsync(new ChatId(id), new InputOnlineFile(stream, "prueba.jpeg"));
|
||||
// await _bot.SendDocument(new ChatId(id), document: inputFile, caption: "imagen de prueba");
|
||||
// await _bot.SendPhoto(new ChatId(id),
|
||||
// "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/6.png", "Wild charizard");
|
||||
|
||||
|
||||
await _bot.SendPhoto(new ChatId(id), inputFile, "mi gorda");
|
||||
}
|
||||
|
||||
@ -84,7 +80,7 @@ public class BotHandler
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
// method that handle messages received by the bot:
|
||||
|
||||
private async Task OnMessage(Message msg, UpdateType type)
|
||||
{
|
||||
if (_bot is null)
|
||||
|
@ -27,11 +27,6 @@ serviceCollection.AddSingleton<BotHandler>();
|
||||
var serviceProvider = serviceCollection.BuildServiceProvider();
|
||||
|
||||
|
||||
|
||||
// var url = "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getMe";
|
||||
|
||||
// var token = ;
|
||||
|
||||
var botHandler = serviceProvider.GetService<BotHandler>();
|
||||
if (botHandler is null)
|
||||
{
|
||||
@ -43,23 +38,15 @@ using var cts = new CancellationTokenSource();
|
||||
|
||||
botHandler.Start(cts.Token);
|
||||
|
||||
// call the bot handler to send a message every minute to the subscribers
|
||||
_ = SendMessageToSubscribers(cts.Token);
|
||||
|
||||
// var bot = new TelegramBotClient(token, cancellationToken: cts.Token);
|
||||
// var me = await bot.GetMe();
|
||||
//
|
||||
// bot.OnError += OnError;
|
||||
// bot.OnMessage += OnMessage;
|
||||
// bot.OnUpdate += OnUpdate;
|
||||
//
|
||||
|
||||
Console.WriteLine($"bot is running... Press Enter to terminate");
|
||||
Console.ReadLine();
|
||||
cts.Cancel(); // stop the bot
|
||||
return;
|
||||
|
||||
//async method to send a message to the subscribers every two minutes with the current time
|
||||
|
||||
async Task SendMessageToSubscribers(CancellationToken cancellationToken)
|
||||
{
|
||||
while (!cancellationToken.IsCancellationRequested)
|
||||
|
Loading…
Reference in New Issue
Block a user