Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var serviceCollection = new ServiceCollection();

            var botClient = new TelegramBotClient("553480406:AAETczW5qnJp4ZkbQ2_E77l2oyzP3IF9qig");
            var cashe     = new ListUser();
            var option    = new TelegramWaitMessage();

            serviceCollection.AddScoped <ICommand, HelloCommand>();
            serviceCollection.AddScoped <ICommand, FuckYouCommand>();
            serviceCollection.AddScoped <ICommand, DefaultCommand>();
            serviceCollection.AddScoped <ICommand, GetRandomStickerCommand>();
            serviceCollection.AddScoped <ICommand, MiniGameCommand>();
            serviceCollection.AddScoped <ICommand, RegisterInTheGameCommand>();
            serviceCollection.AddScoped <ICommand, ListUsersInTheGameCommand>();
            serviceCollection.AddScoped <ICommand, SetNameInTheGameCommand>();
            serviceCollection.AddSingleton(botClient);
            serviceCollection.AddSingleton <Resolver>();
            serviceCollection.AddSingleton <MiniWorker>();
            serviceCollection.AddSingleton(cashe);
            serviceCollection.AddSingleton(option);


            var provider = serviceCollection.BuildServiceProvider();

            Test(provider).Wait();
        }
Exemplo n.º 2
0
 public MiniWorker(TelegramBotClient botClient, Resolver resolver, TelegramWaitMessage waitMessage)
 {
     _botClient   = botClient;
     _resolver    = resolver;
     _waitMessage = waitMessage;
     _queue       = new Queue <Update>();
     _offset      = 0;
 }
 public SetNameInTheGameCommand(TelegramBotClient botClient, TelegramWaitMessage waitMessage)
 {
     _botClient   = botClient;
     _waitMessage = waitMessage;
     CommandText  = "/setName";
 }