private void PublishMessageSync(ISlackMessage slackMessage)
        {
            var slackConnector = new SlackConnector.SlackConnector();
            var connection = slackConnector.Connect(slackMessage.Token).Result;
            var message = new BotMessage
            {
                Text = slackMessage.Text,
                ChatHub =
                    connection.ConnectedChannels()
                        .First(
                            x =>
                                x.Name.Equals("#" + slackMessage.Channel.Trim('#'),
                                    StringComparison.InvariantCultureIgnoreCase))
            };

            connection.Say(message).Wait();
        }
        public void PublishMessage(ISlackMessage slackMessage, bool async = false)
        {
            if (string.IsNullOrWhiteSpace(slackMessage.Token)
                || string.IsNullOrWhiteSpace(slackMessage.Channel)
                || string.IsNullOrWhiteSpace(slackMessage.Username)
                || string.IsNullOrWhiteSpace(slackMessage.Text))
                return;

            if (async)
            {
                PublishMessageAsync(slackMessage);
            }
            else
            {
                PublishMessageSync(slackMessage);
            }
        }
Ejemplo n.º 3
0
        private void PublishMessageSync(ISlackMessage slackMessage)
        {
            var slackConnector = new SlackConnector.SlackConnector();
            var connection     = slackConnector.Connect(slackMessage.Token).Result;
            var message        = new BotMessage
            {
                Text    = slackMessage.Text,
                ChatHub =
                    connection.ConnectedChannels()
                    .First(
                        x =>
                        x.Name.Equals("#" + slackMessage.Channel.Trim('#'),
                                      StringComparison.InvariantCultureIgnoreCase))
            };

            connection.Say(message).Wait();
        }
Ejemplo n.º 4
0
        public void PublishMessage(ISlackMessage slackMessage, bool async = false)
        {
            if (string.IsNullOrWhiteSpace(slackMessage.Token) ||
                string.IsNullOrWhiteSpace(slackMessage.Channel) ||
                string.IsNullOrWhiteSpace(slackMessage.Username) ||
                string.IsNullOrWhiteSpace(slackMessage.Text))
            {
                return;
            }

            if (async)
            {
                PublishMessageAsync(slackMessage);
            }
            else
            {
                PublishMessageSync(slackMessage);
            }
        }
Ejemplo n.º 5
0
        public void PublishMessage(ISlackMessage slackMessage)
        {
            if (string.IsNullOrWhiteSpace(slackMessage.Token) 
                || string.IsNullOrWhiteSpace(slackMessage.Channel)
                || string.IsNullOrWhiteSpace(slackMessage.Username)
                || string.IsNullOrWhiteSpace(slackMessage.Text))
                return;

            var slackConnector = new SlackConnector.SlackConnector();
            var connection = slackConnector.Connect(slackMessage.Token).Result;
            var message = new BotMessage
            {
                Text = slackMessage.Text,
                ChatHub =
                    connection.ConnectedChannels()
                        .First(
                            x => x.Name.Equals("#" + slackMessage.Channel.Trim('#'), StringComparison.InvariantCultureIgnoreCase))
            };

            // when
            connection.Say(message).Wait();
        }
 public TestStart()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
Ejemplo n.º 7
0
 public TestStart()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
 public Membership()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
 public Membership()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
 public Initialize()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
Ejemplo n.º 11
0
 public ListDeletion()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
Ejemplo n.º 12
0
 public Social(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 13
0
 public LoggedIn()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
Ejemplo n.º 14
0
 public Indexing(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 15
0
 public Social()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
Ejemplo n.º 16
0
 public Indexing()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
 public TeamAuthenticationTest(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
 public TeamAuthenticationTest()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
 public Initialize()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
 public MvcException()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
Ejemplo n.º 21
0
 public Package()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
 public MvcException(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 23
0
 public Shutdown()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
Ejemplo n.º 24
0
 public Event(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 25
0
 public Event()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
Ejemplo n.º 26
0
 public LogOut()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
 public ListCreation()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
 public MvcException()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
Ejemplo n.º 29
0
 public Campaign(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
 public MvcException(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 31
0
 public Shutdown(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
 public TeamAuthenticationTest()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
Ejemplo n.º 33
0
 public TestStart(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
 public TeamAuthenticationTest(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 35
0
 public TestStart(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 36
0
 public Security()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
 public Initialize(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 38
0
 public Security(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 39
0
 public Package(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 40
0
 public LoggedIn()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
Ejemplo n.º 41
0
 public LoggedIn(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 42
0
 public LoggedIn(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 43
0
 public Shutdown(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 44
0
 public Social()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
 public Initialize(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 46
0
 public Social(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 47
0
 public Event(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 48
0
 //TODO: After the hackathon we should introduce Dependency Injection 
 public Publish()
 {
    _message = new SlackMessage();
     _service = new SlackService(); 
 }
Ejemplo n.º 49
0
 public ListDeletion(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
 public Membership(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
 public ListCreation(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 52
0
 public Item()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
 public Membership(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 54
0
 public Campaign()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
Ejemplo n.º 55
0
 public Publish(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 56
0
 public Campaign()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
Ejemplo n.º 57
0
 public Campaign(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 58
0
 public Shutdown()
 {
     _message = new SlackMessage();
     _service = new SlackService();
 }
Ejemplo n.º 59
0
 public Item(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }
Ejemplo n.º 60
0
 public Indexing(ISlackService service, ISlackMessage message)
 {
     _message = message;
     _service = service;
 }