1234567891011121314151617181920212223242526272829303132 |
- using System;
- using System.Threading;
- using MafiaTelegramBot.Controllers;
- using MafiaTelegramBot.Resources;
- using Telegram.Bot;
- using Telegram.Bot.Extensions.Polling;
- namespace MafiaTelegramBot
- {
- public static class Bot
- {
- private static TelegramBotClient _client;
- public static TelegramBotClient Client
- {
- get
- {
- if (_client != null) return _client;
- _client = new TelegramBotClient(AppSettings.Token);
- return _client;
- }
- }
-
- public static void Main()
- {
- var cts = new CancellationTokenSource();
- Client.StartReceiving(new DefaultUpdateHandler(MessageController.HandleUpdateAsync, MessageController.HandleErrorAsync), cts.Token);
- Console.ReadLine();
- cts.Cancel();
- }
- }
- }
|