示例#1
0
        private EventProcessor[] GetEventProcessorsForSlackEventType(SlackEventType slackEventType, ChannelProcessingConfiguration <EventProcessor> eventProcessors)
        {
            var result = new EventProcessor[0];

            if (eventProcessors?.EventConfigurations == null)
            {
                return(result);
            }

            if (eventProcessors.EventConfigurations.TryGetValue(slackEventType.ToString(), out var ownEventProcessors))
            {
                if (ownEventProcessors != null)
                {
                    result = result.Concat(ownEventProcessors).ToArray();
                }
            }

            if (eventProcessors.EventConfigurations.TryGetValue("*", out var genericEventProcessors))
            {
                if (genericEventProcessors != null)
                {
                    result = result.Concat(genericEventProcessors).ToArray();
                }
            }

            return(result);
        }
示例#2
0
        private EventProcessor[] GetEventProcessorsForChannel(string channelId, SlackEventType slackEventType, TeamProcessingConfiguration <EventProcessor> eventProcessors)
        {
            var result = new EventProcessor[0];

            if (eventProcessors?.ChannelConfigurations == null)
            {
                return(result);
            }

            if (eventProcessors.ChannelConfigurations.TryGetValue(channelId, out var ownEventProcessors))
            {
                if (ownEventProcessors != null)
                {
                    result = result.Concat(GetEventProcessorsForSlackEventType(slackEventType, ownEventProcessors)).ToArray();
                }
            }

            if (eventProcessors.ChannelConfigurations.TryGetValue("*", out var genericEventProcessors))
            {
                if (genericEventProcessors != null)
                {
                    result = result.Concat(GetEventProcessorsForSlackEventType(slackEventType, genericEventProcessors)).ToArray();
                }
            }

            return(result);
        }