Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class TelegramSupportProvider : ISupportProvider{
- private readonly TelegramBotClient TelegramBot;
- public TelegramSupportProvider(ISerializer serializer,
- TelegramConfiguration telegramConfig) {
- _serializer = serializer;
- _telegramConfig = telegramConfig;
- TelegramBot = new TelegramBotClient(_telegramConfig.BotId);
- TelegramBot.OnMessage += TelegramBot_OnMessage;
- TelegramBot.StartReceiving(new UpdateType[] { UpdateType.CallbackQuery, UpdateType.Message, UpdateType.InlineQuery });
- }
- //Class body
- }
- public void ConfigDi(IServiceCollection service){
- service.AddSingleton<ISupportProvider, TelegramSupportProvider>();
- }
- class Program {
- public static IServiceProvider ServiceProvider { get; private set; }
- static void Main(string[] args) {
- IServiceCollection services = new ServiceCollection();
- Console.WriteLine("Configing Di ");
- ConfigDi(services);
- ISupportProvider telegram = ServiceProvider.GetRequiredService<ISupportProvider>();
- Console.WriteLine("Starting ...");
- Console.ReadLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement