Esempio n. 1
0
 public BittrexTradeExportHandler(DatabaseService databaseService, IMicroBus bus, ILogger <BittrexTradeExportHandler> log, TelegramConfig config)
 {
     _databaseService = databaseService;
     _bus             = bus;
     _log             = log;
     _config          = config;
 }
Esempio n. 2
0
        public Task <ITelegramBotClient> CreateAsync(TelegramConfig config)
        {
            ITelegramBotClient client = new MockTelegramBotClient(
                _loggerFactory.CreateLogger <MockTelegramBotClient>());

            return(Task.FromResult(client));
        }
Esempio n. 3
0
 public Worker(ITerminChecker terminChecker, Settings settings)
 {
     _terminChecker  = terminChecker;
     _config         = settings.GeneralConfig;
     _emailConfig    = settings.EmailConfig;
     _telegramConfig = settings.TelegramConfig;
 }
 public StartupCheckingService(
     IMicroBus bus,
     TelegramConfig telegramConfig,
     TelegramBot bot
     )
 {
     _bus            = bus;
     _telegramConfig = telegramConfig;
     _bot            = bot;
 }
Esempio n. 5
0
 public DocumentMessageHandler(
     ITelegramClient telegramClient,
     IAmazonS3Proxy amazonS3Proxy,
     IDocumentRepostiory documentRepostiory,
     IOptions <TelegramConfig> options)
 {
     _telegramClient     = telegramClient;
     _amazonS3Proxy      = amazonS3Proxy;
     _documentRepostiory = documentRepostiory;
     _telegramConfig     = options.Value;
 }
Esempio n. 6
0
        public ActionsListener(IServiceProvider serviceProvider)
        {
            TelegramConfig telegramConfig = serviceProvider.GetService <IOptions <TelegramConfig> >().Value;

            _bot             = new ActionsBot(telegramConfig.Token);
            _allowedId       = telegramConfig.UserId;
            _allowedUserName = telegramConfig.Username;

            _logger = serviceProvider.GetService <ILogger <ActionsListener> >();

            _cts = new CancellationTokenSource();
        }
        public SenderService(
            IOptionsSnapshot <TelegramConfig> config,
            ILogger <SenderService> logger,
            IProxyService proxyService,
            IChannelConfigService channelConfigService)
        {
            _logger               = logger;
            _proxyService         = proxyService;
            _channelConfigService = channelConfigService;

            _config = config.Value;
        }
Esempio n. 8
0
 public void StartBot(TelegramConfig config)
 {
     try
     {
         ChatId = config.ChatId;
         var bot = new TelegramBotClient(config.BotToken);
         _telegramMessageRecieveService.StartReceivingMessages(bot);
     }
     catch (Exception ex)
     {
         _log.LogError("Could not start key. Invalid bot token\n" + ex.Message);
         throw;
     }
 }
 public TelegramMessageRecieveService(
     IMicroBus bus,
     TelegramMessageSendingService sendingService,
     TelegramBittrexFileUploadService fileImportService,
     TelegramPairProfitService pairProfitService,
     TelegramConfig config,
     ILogger <TelegramMessageRecieveService> log)
 {
     _bus               = bus;
     _sendingService    = sendingService;
     _fileImportService = fileImportService;
     _pairProfitService = pairProfitService;
     _config            = config;
     _log               = log;
 }
Esempio n. 10
0
 public StartupCheckingService(
     IMicroBus bus,
     TelegramConfig telegramConfig,
     TelegramBot bot,
     GeneralConfig config,
     LiteDbDatabaseService liteDbDatabaseService,
     CryptoGramBotDbContext context
     )
 {
     _bus                   = bus;
     _telegramConfig        = telegramConfig;
     _bot                   = bot;
     _config                = config;
     _liteDbDatabaseService = liteDbDatabaseService;
     _context               = context;
 }
 public StartupCheckingService(
     IMicroBus bus,
     TelegramConfig telegramConfig,
     TelegramBot bot,
     CoinigyConfig coinigyConfig,
     PoloniexConfig poloniexConfig,
     BittrexConfig bittrexConfig,
     BinanceConfig binanceConfig
     )
 {
     _bus            = bus;
     _telegramConfig = telegramConfig;
     _bot            = bot;
     _coinigyConfig  = coinigyConfig;
     _poloniexConfig = poloniexConfig;
     _bittrexConfig  = bittrexConfig;
     _binanceConfig  = binanceConfig;
 }
Esempio n. 12
0
        public static bool SendMessage(TelegramConfig telegramConfig, string toUserName, string message)
        {
            var tgClient = new TelegramBotClient(telegramConfig.ApiToken);
            var updates  = tgClient.GetUpdatesAsync().GetAwaiter().GetResult();

            try
            {
                var id = updates
                         .Select(x => x.Message.Chat)
                         .First(x => x.Username != null && x.Username.Equals(toUserName, StringComparison.InvariantCultureIgnoreCase))
                         .Id;

                tgClient.SendTextMessageAsync(new ChatId(id), message).GetAwaiter().GetResult();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Esempio n. 13
0
 public StartupCheckingService(
     IMicroBus bus,
     TelegramConfig telegramConfig,
     TelegramBot bot,
     CoinigyConfig coinigyConfig,
     PoloniexConfig poloniexConfig,
     BittrexConfig bittrexConfig,
     DustConfig dustConfig,
     BagConfig bagConfig,
     LowBtcConfig lowBtcConfig
     )
 {
     _bus            = bus;
     _telegramConfig = telegramConfig;
     _bot            = bot;
     _coinigyConfig  = coinigyConfig;
     _poloniexConfig = poloniexConfig;
     _bittrexConfig  = bittrexConfig;
     _dustConfig     = dustConfig;
     _bagConfig      = bagConfig;
     _lowBtcConfig   = lowBtcConfig;
 }
Esempio n. 14
0
 public CoreApplicationConfig()
 {
     Database = new DatabaseConfig();
     Telegram = new TelegramConfig();
     Cache    = new CacheConfig();
 }
Esempio n. 15
0
 public TelegramMessageReceiveService(ILogger <TelegramMessageReceiveService> log, TelegramConfig options, DatabaseService databaseService)
 {
     _log             = log;
     _config          = options;
     _databaseService = databaseService;
 }
Esempio n. 16
0
 public TelegramService(ILogger <TelegramService> logger, IConfiguration configuration)
 {
     _logger         = logger;
     _telegramConfig = configuration.GetSection("Telegram").Get <TelegramConfig>();
 }
Esempio n. 17
0
 public TelegramClient(IOptions <TelegramConfig> options)
 {
     _telegramConfig    = options.Value;
     _telegramBotClient = new TelegramBotClient(_telegramConfig.Token);
 }
Esempio n. 18
0
 public ChannelConfigService(IOptionsSnapshot <TelegramConfig> config)
 {
     _config = config.Value;
 }
 public SendMessageHandler(TelegramBot bot, ILogger <SendMessageHandler> log, TelegramConfig config)
 {
     _bot    = bot;
     _log    = log;
     _config = config;
 }
Esempio n. 20
0
 public SendFileHandler(TelegramBot bot, TelegramConfig config)
 {
     _bot    = bot;
     _config = config;
 }
Esempio n. 21
0
 public StartupCheckingService(TelegramBot bot, TelegramConfig options)
 {
     _bot    = bot;
     _config = options;
 }
Esempio n. 22
0
 public Telegram(TelegramConfig config, ISenderData sender)
 {
     _config = config;
     _sender = sender;
 }