コード例 #1
0
        public SendMessageTests()
        {
            this.state  = SlackBotState.Initialize("1", "testbot");
            this.config = new TestConfig();

            this.bus = new RxMessageBus();
        }
コード例 #2
0
ファイル: SlackBot.cs プロジェクト: sebostian/SlackBotNet
        private SlackBot(
            SlackBotState state,
            IDriver driver,
            IMessageBus bus,
            ISlackBotConfig config,
            ILogger <SlackBot> logger)
        {
            this.state  = state;
            this.config = config;
            this.logger = logger;

            this.driver     = driver;
            this.messageBus = bus;

            this.whenHandlers = new ConcurrentQueue <WhenHandler>();

            this.sendMessageQueue = new MessageThrottleQueue(
                TimeSpan.FromSeconds(1.0), // ~1/sec (see: https://api.slack.com/methods/chat.postMessage)
                driver,
                logger,
                (queue, msg, lg, ex) =>
            {
                config?.OnSendMessageFailure?.Invoke(queue, msg, lg, ex);
            });

            this.uploadFileQueue = new ThrottleQueue <File>(
                TimeSpan.FromSeconds(3), // ~20/min (see: https://api.slack.com/methods/files.upload)
                logger,
                this.driver.UploadFileAsync,
                null);
        }
コード例 #3
0
        public BotInitializeTests()
        {
            this.state  = SlackBotState.Initialize("1", "testbot");
            this.config = new TestConfig();

            this.driver = new TestDriver(this.state);
            this.bus    = new RxMessageBus();
        }
コード例 #4
0
ファイル: HandlerTests.cs プロジェクト: sebostian/SlackBotNet
        public async Task InitializeAsync()
        {
            this.state  = SlackBotState.Initialize("1", "testbot");
            this.config = new TestConfig();

            this.driver = new TestDriver(this.state);
            this.bus    = new RxMessageBus();

            this.bot = await SlackBot.InitializeAsync(this.driver, this.bus);
        }
コード例 #5
0
        private SlackBot(
            SlackBotState state,
            IDriver driver,
            IMessageBus bus,
            ISlackBotConfig config,
            ILogger <SlackBot> logger)
        {
            this.state  = state;
            this.config = config;
            this.logger = logger;

            this.driver     = driver;
            this.messageBus = bus;

            this.whenHandlers = new ConcurrentQueue <WhenHandler>();

            this.sendMessageQueue = new SendMessageQueue(TimeSpan.FromSeconds(1), driver, logger, config.OnSendMessageFailure);
        }