-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
48 lines (41 loc) · 1.5 KB
/
Program.cs
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using Microsoft.Extensions.DependencyInjection;
using SoftwareTraining.Client;
using SoftwareTraining.CommandFactory;
using SoftwareTraining.Constant;
using SoftwareTraining.DependencyInjection;
using SoftwareTraining.Entity;
using SoftwareTraining.Enum;
using SoftwareTraining.HttpClientFactory;
using SoftwareTraining.Repository.Dapper.Interface;
using SoftwareTraining.TelegramBotEvent;
using SoftwareTraining.TelegramCommand.Interface;
using SoftwareTraining.TelegramCommand.Service;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using Telegram.Bot;
using Telegram.Bot.Types;
using Telegram.Bot.Types.Enums;
namespace SoftwareTraining
{
class Program
{
public static ITelegramClient telegramClient { get; set; }
public static ITelegramBotClient telegramBotClient { get; set; }
public static TelegramDependency telegramDependency = new TelegramDependency();
static void Main(string[] args)
{
Console.WriteLine("Bot Started...");
IServiceProvider serviceProvider = telegramDependency.Dependencies();
telegramClient = serviceProvider.GetRequiredService<ITelegramClient>();
telegramBotClient = telegramClient.CreateInstance();
telegramBotClient.StartReceiving();
telegramBotClient.OnMessage += OnMessage.BotOnMessage;
while(true)
{
Task.Delay(TimeSpan.FromSeconds(5)).Wait();
}
}
}
}