private async Task SetQueueListenerForChannel(Activity activity)
        {
            IQueueListenerPostChannel channel = null;

            switch (activity.ChannelId)
            {
            case "msteams":
                channel = new TeamsQueueListenerChannel()
                {
                    ServiceUrl     = activity.ServiceUrl,
                    BotId          = activity.Recipient.Id,
                    ChannelId      = activity.ChannelId,
                    BotName        = activity.Recipient.Name,
                    TeamsChannelId = activity.GetChannelData <TeamsChannelData>().Channel.Id
                };
                break;

            default:
                channel = new SkypeEmulatorListenerChannel()
                {
                    ServiceUrl     = activity.ServiceUrl,
                    BotId          = activity.Recipient.Id,
                    BotName        = activity.Recipient.Name,
                    ChannelId      = activity.ChannelId,
                    ConversationId = activity.Conversation.Id
                };
                break;
            }

            if (listener != null)
            {
                await listener.AddChannel(channel);
            }
        }
Esempio n. 2
0
        public async Task AddChannel(IQueueListenerPostChannel queueListenerPostChannel)
        {
            var channels = await GetChannels();

            if (!channels.Any(x => x.Equals(queueListenerPostChannel)))
            {
                await tableStorageProvider.SendToTableAsync("expertBotChannels", new QueueListenerPostChannelTableEntity()
                {
                    ChannelObject = JsonConvert.SerializeObject(queueListenerPostChannel),
                    Type          = queueListenerPostChannel.ChannelType
                });
            }
        }