Пример #1
0
 public FriendPoller(TelegramClient telegramClient, PSNService psnService, AccountService accounts, RegistrationProcess registrationProcess)
 {
     _telegramClient      = telegramClient;
     _psnService          = psnService;
     _accounts            = accounts;
     _registrationProcess = registrationProcess;
 }
Пример #2
0
 public ListCommand(PSNService psnService, TelegramClient telegramClient, AccountService accounts)
 {
     _psnService     = psnService;
     _telegramClient = telegramClient;
     _accounts       = accounts;
     _regex          = new Regex("^/list", RegexOptions.IgnoreCase);
 }
Пример #3
0
 public SearchCommand(PSNService psnService, TelegramClient telegramClient, AccountService accounts)
 {
     _psnService     = psnService;
     _telegramClient = telegramClient;
     _accounts       = accounts;
     _regex          = new Regex("^/search(\\s+(?<param>.+))?", RegexOptions.IgnoreCase);
 }
Пример #4
0
 public StartCommand(PSNService psnService, TelegramClient telegramClient, AccountService accounts, RegistrationProcess registrationProcess)
 {
     _psnService          = psnService;
     _telegramClient      = telegramClient;
     _accounts            = accounts;
     _registrationProcess = registrationProcess;
     _regex = new Regex("^/start", RegexOptions.IgnoreCase);
 }
Пример #5
0
 public ImagePoller(TelegramClient telegramClient, PSNService psnService, AccountService accounts, TimeStampService timestampService, long chatId)
 {
     _chatId           = chatId;
     _telegramClient   = telegramClient;
     _psnService       = psnService;
     _accounts         = accounts;
     _timestampService = timestampService;
 }
Пример #6
0
 public DeleteCommand(PSNService psnService, TelegramClient telegramClient, AccountService accounts, RegistrationProcess process)
 {
     _psnService     = psnService;
     _telegramClient = telegramClient;
     _accounts       = accounts;
     _regex          = new Regex("^/delete", RegexOptions.IgnoreCase);
     _process        = process;
 }
Пример #7
0
        public Startup()
        {
            _client = new PSNService();

            var database = new DatabaseService("../../../psnbot.sqlite");

            _accounts = new AccountService(database);

            var task = _client.Login("*****@*****.**", "");

            task.Wait();
        }
Пример #8
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.Unicode;

            var client = new PSNService();
            var task   = client.Login("*****@*****.**", "");

            task.Wait();

            if (!task.Result)
            {
                Console.WriteLine("Failed to login");
                return;
            }

            var telegramClient = new Telegram.TelegramClient("");
            var database       = new DatabaseService("../../../psnbot.sqlite");

            var accounts         = new AccountService(database);
            var timestampService = new TimeStampService(database);

            var registrationProcess = new RegistrationProcess(telegramClient, client, accounts);

            var chatId = -1001019649766;

            using (var poller = new MessagePoller(database, telegramClient, client, accounts, registrationProcess, chatId))
                using (var imagePoller = new ImagePoller(telegramClient, client, accounts, timestampService, chatId))
                    using (var trophyPoller = new TrophyPoller(telegramClient, client, accounts, timestampService, chatId))
                        using (var friendPoller = new FriendPoller(telegramClient, client, accounts, registrationProcess))
                        {
                            poller.Start();
                            imagePoller.Start();
                            //trophyPoller.Start();
                            friendPoller.Start();

                            var host = new WebHostBuilder()
                                       .UseKestrel()
                                       .UseStartup <Startup>()
                                       .Build();
                            host.Run();
                        }
        }
Пример #9
0
        public MessagePoller(DatabaseService databaseService, TelegramClient client, PSNService psnService, AccountService accounts,
                             RegistrationProcess registrationProcess, long chatId)
        {
            _chatId              = chatId;
            _client              = client;
            _psnService          = psnService;
            _accounts            = accounts;
            _databaseService     = databaseService;
            _registrationProcess = registrationProcess;

            _commands = new Command[]
            {
                new TopCommand(_psnService, client, _accounts),
                new SearchCommand(_psnService, client, _accounts),
                new ListCommand(_psnService, client, _accounts),
                new StartCommand(_psnService, client, _accounts, _registrationProcess),
                new HelpCommand(_psnService, client, _accounts),
                new RulesCommand(_psnService, client, _accounts),
                new OnlineCommand(_psnService, client, _accounts),
                new DeleteCommand(_psnService, client, _accounts, _registrationProcess),
                new SetInterestsCommand(_psnService, client, _accounts, _registrationProcess),
                new SetTrophiesCommand(_psnService, client, _accounts, _registrationProcess),
            };
        }
Пример #10
0
 public RegistrationProcess(TelegramClient telegramClient, PSNService psnService, AccountService accountService)
 {
     _telegramClient = telegramClient;
     _psnService     = psnService;
     _accountService = accountService;
 }