コード例 #1
0
        public MessagesController()
        {
            IUsersRepository usersRepository = new UsersRepository(_connectionString);

            _chatsRepository    = new ChatsRepository(_connectionString, usersRepository);
            _messagesRepository = new MessagesRepository(_connectionString, usersRepository, _chatsRepository);
        }
コード例 #2
0
 public UsersRepository(string connectionString, IAuthRepository authRepository = null,
                        IChatsRepository chatReposirory = null)
 {
     _connectionString = connectionString;
     _authRepository   = authRepository ?? new AuthRepository(_connectionString, this);
     _chatReposirory   = chatReposirory ?? new ChatsRepository(_connectionString, this);
 }
コード例 #3
0
        public AccountSessionHandler(SessionData sessionData, ILogger <AccountSessionHandler> logger, IChatsRepository chatsRepository, SubscriptionFactory subscriptionFactory)
        {
            _sessionData     = sessionData;
            _logger          = logger;
            _chatsRepository = chatsRepository;
            _subscription    = subscriptionFactory.Create();
            _sessionSubject  = new BehaviorSubject <SessionData>(sessionData);
            _subscription.Add(_sessionSubject);
            SessionChanges = _sessionSubject;
            _cancelSubject = new Subject <Unit>();
            _subscription.Add(_cancelSubject);

            _supportedMessages = new Dictionary <string, Func <IObservable <Unit> > >(StringComparer.OrdinalIgnoreCase)
            {
                { "/start", () => Observable.Empty <Unit>() },
                { "/stop", () => Observable.Empty <Unit>() },
                { "/help", () => ShowHelp() },
                { "/login", () => Login() },
                { "/username", () => RequestUsername() },
                { "/session", () => RequestSession() },
                { "/token", () => RequestAuthToken() },
                { "/cancel", () => Cancel() },
                { "/pause", () => StartPauseDialog() },
                { "/resume", () => Resume() },
                { "/mute", () => StartMuteDialog() },
                { "/unmute", () => Unmute() },
                { "/timezone", () => RequestTimezone() },
            };
        }
コード例 #4
0
 public AccountsHandler(ILogger <AccountsHandler> accountsHandlerLogger, ILogger <AccountSessionHandler> accountsLogger, SubscriptionFactory subscriptionFactory, IAccountsService accountsService, IChatsRepository chatsRepository)
 {
     this._accountsHandlerLogger = accountsHandlerLogger;
     _accountsLogger             = accountsLogger;
     _subscriptionFactory        = subscriptionFactory;
     _accountsService            = accountsService;
     _chatsRepository            = chatsRepository;
 }
コード例 #5
0
 public MessagesRepository(string connectionString, IUsersRepository usersRepository = null,
                           IAttachsRepository attachsRepository = null, IChatsRepository chatsRepository = null)
 {
     _connectionString  = connectionString;
     _usersRepository   = usersRepository ?? new UsersRepository(_connectionString);
     _attachsRepository = attachsRepository ?? new AttachsRepository(_connectionString, _usersRepository);
     _chatsRepository   = chatsRepository ?? new ChatsRepository(_connectionString, _usersRepository, _attachsRepository, this);
 }
コード例 #6
0
 public DefaultController(
     IWordsRepository <Word, WordsCountBotDbContext> wordsRepo,
     IChatsRepository <Chat, WordsCountBotDbContext> chatsRepo,
     IUsagesRepository <WordUsedTimes, WordsCountBotDbContext> usagesRepo
     )
 {
     _wordsRepo  = wordsRepo;
     _chatsRepo  = chatsRepo;
     _usagesRepo = usagesRepo;
 }
コード例 #7
0
        public TelegramAccountsHandler(SubscriptionFactory subscriptionFactory, IChatsRepository chatsRepository, BotClientFactory botClientFactory, MessageFactory messageFactory, MessageSender messageSender)
        {
            _subscriptions  = subscriptionFactory.Create();
            _sessionChanges = new Subject <SessionData>();
            _subscriptions.Add(_sessionChanges);

            _chatsRepository    = chatsRepository;
            _botClientFactory   = botClientFactory;
            _messageFactory     = messageFactory;
            this._messageSender = messageSender;
        }
コード例 #8
0
 public WcbTelegramBot(
     ILogger <WcbTelegramBot> logger,
     IWordsRepository <Word, WordsCountBotDbContext> wordsRepo,
     IChatsRepository <MyChat, WordsCountBotDbContext> chatsRepo,
     IUsagesRepository <WordUsedTimes, WordsCountBotDbContext> usagesRepo,
     IWcbTelegramClient client
     )
 {
     _logger     = logger;
     _wordsRepo  = wordsRepo;
     _chatsRepo  = chatsRepo;
     _usagesRepo = usagesRepo;
     _client     = client;
 }
コード例 #9
0
 public TableTennisBot(
     TelegramBotConfiguration configuration,
     RealTimeRetriever realTimeRetriever,
     IChatsRepository chatsRepository,
     IAccessTokenRepository accessTokenRepository)
 {
     _configuration         = configuration ?? throw new ArgumentNullException(nameof(configuration));
     _realTimeRetriever     = realTimeRetriever ?? throw new ArgumentNullException(nameof(realTimeRetriever));
     _chatsRepository       = chatsRepository ?? throw new ArgumentNullException(nameof(chatsRepository));
     _accessTokenRepository =
         accessTokenRepository ?? throw new ArgumentNullException(nameof(accessTokenRepository));
     _botClient            = new TelegramBotClient(_configuration.AccessToken);
     _botClient.OnMessage += MessageHandler;
     _realTimeRetriever.OnGoodBigScorePercentageFound += GoodBigScorePercentageHandler;
     _botClient.StartReceiving();
 }
コード例 #10
0
 public ChatsController(IChatsRepository chatsRepository)
 {
     _chatsRepository = chatsRepository;
 }
コード例 #11
0
 public ChatController()
 {
     _profilesRepository = new ProfilesRepository(Constants.Constants.ConnectionString);
     _chatsRepository    = new ChatsRepository(Constants.Constants.ConnectionString, _profilesRepository);
 }
コード例 #12
0
 public MessagesRepository(string connectionString, IUsersRepository usersRepository, IChatsRepository chatsRepository)
 {
     _connectionString = connectionString;
     _usersRepository = usersRepository;
     _chatsRepository = chatsRepository;
 }
コード例 #13
0
 public ChatsBusinessWorkflow(IChatsRepository chatsRepository, IChatMapper chatMapper)
 {
     ChatsRepository = chatsRepository;
     ChatMapper = chatMapper;
 }
コード例 #14
0
 /// <summary>
 ///     Инициализация строки подключения для работы с таблицей "Профили".
 /// </summary>
 /// <param name="connectionString">Строка подключения.</param>
 public ProfilesRepository(string connectionString)
 {
     _connectionString = connectionString;
     _chatsRepository  = new ChatsRepository(connectionString, this);
 }
コード例 #15
0
 public ChatsBusinessWorkflow(IChatsRepository chatsRepository, IChatMapper chatMapper)
 {
     ChatsRepository = chatsRepository;
     ChatMapper      = chatMapper;
 }
コード例 #16
0
 public SessionsController(IChatsRepository chatsRepository)
 {
     _chatsRepository = chatsRepository;
 }