コード例 #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="directLineSecret">The Direct Line secret associated with the bot.</param>
        /// <param name="consumerKey">The Twitter consumer key.</param>
        /// <param name="consumerSecret">The Twitter consumer secret.</param>
        /// <param name="accessToken">The Twitter app access token.</param>
        /// <param name="accessTokenSecret">The Twitter app secret.</param>
        /// <param name="messageAndUserIdCache">A message and user ID cache implementation.</param>
        public TwitterBotIntegrationManager(
            string directLineSecret,
            string consumerKey, string consumerSecret,
            string accessToken = null, string accessTokenSecret = null,
            IMessageAndUserIdCache messageAndUserIdCache = null)
        {
            _directLineManager     = new DirectLineManager(directLineSecret);
            _twitterManager        = new TwitterManager(consumerKey, consumerSecret, accessToken, accessTokenSecret);
            _messageAndUserIdCache = messageAndUserIdCache ?? new InMemoryMessageAndUserIdCache();

            _directLineManager.ActivitiesReceived += OnActivitiesReceived;
            _twitterManager.TweetReceived         += OnTweetReceivedAsync;
        }
コード例 #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="directLineSecret">The Direct Line secret associated with the bot.</param>
        /// <param name="consumerKey">The Twitter consumer key.</param>
        /// <param name="consumerSecret">The Twitter consumer secret.</param>
        /// <param name="bearerToken"></param>
        /// <param name="accessToken">The Twitter app access token.</param>
        /// <param name="accessTokenSecret">The Twitter app secret.</param>
        /// <param name="conversationCache">A message and user ID cache implementation.</param>
        public TwitterBotIntegrationManager(
            string directLineSecret,
            string consumerKey, string consumerSecret,
            string bearerToken = null,
            string accessToken = null, string accessTokenSecret = null,
            IDirectLineConversationCache directLineConversationCache = null,
            ITweetConversationCache tweetConversationCache           = null)
        {
            _directLineManager = new DirectLineManager(directLineSecret, directLineConversationCache ?? new InMemoryConversationCache());
            _twitterManager    = new TwitterManager(consumerKey, consumerSecret, bearerToken, accessToken, accessTokenSecret);
            _conversationCache = tweetConversationCache ?? new InMemoryConversationCache();

            _directLineManager.ActivitiesReceived += OnActivitiesReceived;
            _twitterManager.TweetReceived         += OnTweetReceivedAsync;
        }