Beispiel #1
0
        public TwitterBot(TwitterSettings settings, PokeTradeHub <PK8> hub)
        {
            Hub      = hub;
            Settings = settings;

            client = new TwitterClient(Settings.ConsumerKey, Settings.ConsumerSecret, Settings.AccessToken, Settings.AccessTokenSecret);

            client.Events.OnTwitterException += HandleTwitterException;

            try
            {
                var taskAuthenticate = Task.Run(async() => await client.Users.GetAuthenticatedUserAsync());
                TwitterUser = taskAuthenticate.Result;
                LogUtil.LogText($"Successfully authenticated as: @{TwitterUser.ScreenName}");

                MentionParams = new GetMentionsTimelineParameters {
                    PageSize = Settings.MentionCount
                };
                var taskGetInitialMentions = Task.Run(async() => await client.Timelines.GetMentionsTimelineAsync(MentionParams));
                localMentions = new TwitterMentions(taskGetInitialMentions.Result);
                Task.Run(() => CheckMentionsForTradesAsync(localMentions, CancellationToken.None));
            }
            catch (Exception e)
            {
                LogUtil.LogError($"Unable to authenticate with error: {e.Message}", nameof(TwitterBot));
            }
        }
Beispiel #2
0
        public static void AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
        {
            services.AddHttpClient();

            services.AddDbContext <FilmunityDataContext>(options =>
                                                         options.UseSqlServer(configuration.GetConnectionString("FilmunityDatabase")));

            services.AddScoped <IUnitOfWork, UnitOfWork>();

            services.Configure <CloudinarySettings>(configuration.GetSection("CloudinarySettings"));
            services.AddScoped <ICloudUploadService, CloudUploadService>();

            services.Configure <FacebookSettings>(configuration.GetSection("FacebookSettings"));
            var facebookSettings = new FacebookSettings();

            configuration.Bind(nameof(FacebookSettings), facebookSettings);
            services.AddSingleton(facebookSettings);
            services.AddScoped <IFacebookService, FacebookService>();

            services.Configure <OmdbSettings>(configuration.GetSection("OmdbSettings"));
            var omdbSettings = new OmdbSettings();

            configuration.Bind(nameof(OmdbSettings), omdbSettings);
            services.AddSingleton(omdbSettings);
            services.AddScoped <IOmdbService, OmdbService>();

            services.Configure <TwitterSettings>(configuration.GetSection("TwitterSettings"));
            var twitterSettings = new TwitterSettings();

            configuration.Bind(nameof(TwitterSettings), twitterSettings);
            services.AddSingleton(twitterSettings);
            services.AddScoped <TweetSharp.ITwitterService, TweetSharp.TwitterService>();
            services.AddScoped <ITwitterService, TwitterService>();
        }
Beispiel #3
0
        public IEnumerable <ValidationResult> ValidateSettings(TwitterSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (string.IsNullOrWhiteSpace(settings.ConsumerKey))
            {
                yield return(new ValidationResult(S["ConsumerKey is required"], new string[] { nameof(settings.ConsumerKey) }));
            }

            if (string.IsNullOrWhiteSpace(settings.ConsumerSecret))
            {
                yield return(new ValidationResult(S["ConsumerSecret is required"], new string[] { nameof(settings.ConsumerSecret) }));
            }

            if (string.IsNullOrWhiteSpace(settings.AccessToken))
            {
                yield return(new ValidationResult(S["Access Token is required"], new string[] { nameof(settings.AccessToken) }));
            }

            if (string.IsNullOrWhiteSpace(settings.AccessTokenSecret))
            {
                yield return(new ValidationResult(S["Access Token Secret is required"], new string[] { nameof(settings.AccessTokenSecret) }));
            }
        }
        private TwitterSettings GetTwitterSettings(IConfiguration configuration)
        {
            TwitterSettings twitterSettings;

            if (EnvironmentHelper.InDocker)
            {
                twitterSettings = new TwitterSettings
                {
                    ConsumerKey       = Environment.GetEnvironmentVariable("ConsumerKey"),
                    ConsumerSecret    = Environment.GetEnvironmentVariable("ConsumerSecret"),
                    AccessToken       = Environment.GetEnvironmentVariable("AccessToken"),
                    AccessTokenSecret = Environment.GetEnvironmentVariable("AccessTokenSecret")
                };
            }
            else
            {
                twitterSettings = configuration.GetSection("Twitter").Get <TwitterSettings>();
            }

            this.logger.LogInformation("Twitter Consumer Key: {0}", GetStatus(twitterSettings.ConsumerKey));
            this.logger.LogInformation("Twitter Consumer Secret: {0}", GetStatus(twitterSettings.ConsumerSecret));
            this.logger.LogInformation("Twitter Access Token: {0}", GetStatus(twitterSettings.AccessToken));
            this.logger.LogInformation("Twitter Access Token Secret: {0}", GetStatus(twitterSettings.AccessTokenSecret));

            return(twitterSettings);
        }
Beispiel #5
0
        /// <summary>
        /// Check that twitter credentials in Settings are still valid.
        /// If the credentials provided are invalid then clear them to force re-entry.
        /// </summary>
        /// <returns>trus if valid</returns>
        private static bool VerifyCredentials()
        {
#if UNITY_EDITOR
            float time = (float)EditorApplication.timeSinceStartup;
#else
            float time = Time.time;
#endif
            if (time > verifyCredentialsTime)
            {
                Dictionary <string, string> dict = new Dictionary <string, string>();
                OAuthHelper.AddDefaultOAuthParams(dict, TwitterSettings.EDITOR_PREFS_TWITTER_API_KEY, TwitterSettings.EDITOR_PREFS_TWITTER_API_SECRET);
                if (ApiGetRequest(TwitterSettings.VerifyCredentialsURL, dict, out string response))
                {
                    verifyCredentialsTime = time + 600; // validate every 10 minutes
                    return(true);
                }
                else
                {
                    TwitterSettings.ClearAccessTokens();
                    Debug.LogError(response);
                    return(false);
                }
            }
            else
            {
                return(true);
            }
        }
Beispiel #6
0
        private static Settings CreateSettings()
        {
            SettingConfigurationSection section = (SettingConfigurationSection)ConfigurationManager.GetSection(SettingConfigurationSection.SectionName);

            ApiSettings api = new ApiSettings(section.Api.Allowed, section.Api.DailyLimit);

            ThumbnailSettings thumbnail = new ThumbnailSettings(section.Thumbnail.ApiKey, section.Thumbnail.Endpoint);

            GoogleSafeBrowsingSettings google = new GoogleSafeBrowsingSettings(section.Google.ApiKey, section.Google.Endpoint, HttpContext.Current.Server.MapPath(section.Google.PhishingFile), HttpContext.Current.Server.MapPath(section.Google.MalwareFile));

            TwitterSettings twitter = null;

            if (section.Twitter != null)
            {
                twitter = new TwitterSettings(section.Twitter.UserName, section.Twitter.Password, section.Twitter.Endpoint, section.Twitter.MessageTemplate, section.Twitter.MaximumMessageLength, section.Twitter.Recipients.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
            }

            IList <User> defaultUsers = new List <User>();

            foreach (DefaultUserConfigurationElement configuration in section.DefaultUsers)
            {
                defaultUsers.Add(new User {
                    Name = configuration.Name, Email = configuration.Email, Role = configuration.Role
                });
            }

            Settings settings = new Settings(section.RedirectPermanently, section.UrlPerPage, section.BaseType, api, thumbnail, google, twitter, defaultUsers);

            return(settings);
        }
 public TwitterUserService(TwitterSettings settings, ITwitterStatisticsHandler statisticsHandler, ILogger <TwitterUserService> logger)
 {
     _settings          = settings;
     _statisticsHandler = statisticsHandler;
     _logger            = logger;
     Auth.SetApplicationOnlyCredentials(_settings.ConsumerKey, _settings.ConsumerSecret, true);
     ExceptionHandler.SwallowWebExceptions = false;
 }
Beispiel #8
0
 public TweetCashController(ITweetsCashRepository tweetCashRepository,
                            ITwitterAppAccountRepository twitterAppAccountRepository,
                            TwitterSettings twitterSettings,
                            ILog log, ITweetsManager tweetsManager)
 {
     _tweetCashRepository         = tweetCashRepository;
     _twitterAppAccountRepository = twitterAppAccountRepository;
     _twitterSettings             = twitterSettings;
     _log           = log;
     _tweetsManager = tweetsManager;
 }
Beispiel #9
0
 public TwitterApiService(ILogger logger, TwitterSettings twitterSettings)
 {
     _logger          = logger;
     _twitterSettings = twitterSettings;
     _httpClient      = new HttpClient()
     {
         BaseAddress = new Uri(_twitterSettings.BaseUrl),
         Timeout     = TimeSpan.FromDays(1)
     };
     _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _twitterSettings.BearerToken);
 }
Beispiel #10
0
        public static void Initialize()
        {
            account = new DollsLib.Twitter.AccountManager();
            settings = SettingManager.Settings.Twitter;

            if (!settings.WriteEnabled)
            {
                Log.Trace.TraceEvent(TraceEventType.Warning, 0,
                    "Twitter write feature is disabled. Only to log.");
            }
        }
Beispiel #11
0
 public AuthenticationController(
     SignInManager<ApplicationUser> signInManager,
     UserManager<ApplicationUser> userManager,
     RolesSettings rolesSettings,
     TwitterSettings twitterSettings)
 {
     _signInManager = signInManager;
     _userManager = userManager;
     _rolesSettings = rolesSettings;
     _twitterSettings = twitterSettings;
 }    
Beispiel #12
0
 public SocialSettingsViewModel()
 {
     if (Configuration.Instance.Social is TwitterSettings)
     {
         TwitterSettings s = Configuration.Instance.Social as TwitterSettings;
         ConsumerKey    = s.ConsumerKey;
         ConsumerSecret = s.ConsumerSecret;
         AccessKey      = s.AccessToken;
         AccessSecret   = s.AccessTokenSecret;
     }
     MessengerInstance.Register <NotificationMessage>(this, (m) => Save(m));
 }
Beispiel #13
0
        public TwitterTradeNotifier(T data, PokeTradeTrainerInfo info, int code, string username, TwitterClient client, IUser user, TwitterSettings settings)
        {
            Data     = data;
            Info     = info;
            Code     = code;
            Username = username;
            Client   = client;
            UserToDM = user;
            Settings = settings;

            LogUtil.LogText($"Created trade details for {Username} - {Code}");
        }
Beispiel #14
0
        public void SendNotification(string message, TwitterSettings settings)
        {
            try
            {
                var oAuth = new TinyTwitter.OAuthInfo
                {
                    ConsumerKey = settings.ConsumerKey,
                    ConsumerSecret = settings.ConsumerSecret,
                    AccessToken = settings.AccessToken,
                    AccessSecret = settings.AccessTokenSecret
                };

                var twitter = new TinyTwitter.TinyTwitter(oAuth);

                if (settings.DirectMessage)
                {
                    twitter.DirectMessage(message, settings.Mention);
                }

                else
                {
                    if (settings.Mention.IsNotNullOrWhiteSpace())
                    {
                        message += string.Format(" @{0}", settings.Mention);
                    }

                    twitter.UpdateStatus(message);
                }
            }
            catch (WebException ex)
            {
                using (var response = ex.Response)
                {
                    var httpResponse = (HttpWebResponse)response;

                    using (var responseStream = response.GetResponseStream())
                    {
                        if (responseStream == null)
                        {
                            _logger.Trace("Status Code: {0}", httpResponse.StatusCode);
                            throw new TwitterException("Error received from Twitter: " + httpResponse.StatusCode, ex);
                        }

                        using (var reader = new StreamReader(responseStream))
                        {
                            var responseBody = reader.ReadToEnd();
                            _logger.Trace("Reponse: {0} Status Code: {1}", responseBody, httpResponse.StatusCode);
                            throw new TwitterException("Error received from Twitter: " + responseBody, ex);
                        }
                    }
                }
            }
        }
Beispiel #15
0
        public StreamManager(
            ITwitterStreamingClient twitterStreamingClient,
            ISentimentAnalysisService sentimentAnalysisService,
            IEventHubService eventHubService,
            ILoggerFactory loggerFactory,
            TwitterSettings twitterSettings)
        {
            this.twitterStreamingClient   = twitterStreamingClient;
            this.sentimentAnalysisService = sentimentAnalysisService;
            this.eventHubService          = eventHubService;
            this.twitterSettings          = twitterSettings;

            this.logger = loggerFactory.CreateLogger(nameof(StreamManager));
        }
Beispiel #16
0
        public async Task UpdateSettingsAsync(TwitterSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            var container = await _siteService.LoadSiteSettingsAsync();

            container.Alter <TwitterSettings>(nameof(TwitterSettings), aspect =>
            {
                aspect.ConsumerKey       = settings.ConsumerKey;
                aspect.ConsumerSecret    = settings.ConsumerSecret;
                aspect.AccessToken       = settings.AccessToken;
                aspect.AccessTokenSecret = settings.AccessTokenSecret;
            });
            await _siteService.UpdateSiteSettingsAsync(container);
        }
Beispiel #17
0
        public static async Task ExportTwitterSettings(TwitterSettings TwitterSettings)
        {
            List <TwitterSettings> ToWrite = new List <TwitterSettings>();

            ToWrite.Add(TwitterSettings);

            string FilePath = Path.Combine(Constants.AppFolder(Constants.AppDirectory.DataTwitterSettings));

            //TwitterSettings = TwitterSettings;

            FilePath = Path.Combine(FilePath, "TwSettings.csv");
            using (StreamWriter write = new StreamWriter(FilePath, false))
            {
                CsvWriter csw = new CsvWriter(write, CultureInfo.InvariantCulture);
                csw.WriteHeader <TwitterSettings>(); // writes the csv header for this class
                csw.NextRecord();
                csw.WriteRecords(ToWrite);           //WriteRecords, if you convert to list.
            }
        }
        public static void SetSettings(this ITwitterService service, TwitterBindingAttribute attribute)
        {
            if (service == null)
            {
                throw new NullReferenceException(nameof(service));
            }
            if (attribute == null)
            {
                throw new ArgumentNullException(nameof(attribute));
            }

            var twitterSettings = new TwitterSettings();

            twitterSettings.ConsumerKey       = attribute.ConsumerKey;
            twitterSettings.ConsumerSecret    = attribute.ConsumerSecret;
            twitterSettings.AccessToken       = attribute.AccessToken;
            twitterSettings.AccessTokenSecret = attribute.AccessTokenSecret;

            service.Settings = twitterSettings;
        }
Beispiel #19
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            var twitterKeys = new TwitterSettings();

            Configuration.Bind("Twitter", twitterKeys);
            services.AddSingleton(twitterKeys);
            services.AddSingleton <ILogger, ConsoleLogService>();
            services.AddSingleton <ITwitterApiService, TwitterApiService>();
            services.AddSingleton <IEmojiService, EmojiService>();
            services.AddSingleton <ITwitterService, TwitterService>();
            services.AddSingleton <ITwitterDatabase, TwitterDatabase>();
            services.AddSwaggerGen(swagger =>
            {
                swagger.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "Twitter  Statistics", Version = "v1"
                });
            });
        }
Beispiel #20
0
        public TwitterClientTests()
        {
            mockFakeHttpMessageHandler = new Mock <FakeHttpMessageHandler>()
            {
                CallBase = true
            };

            var fakeDataProtector = new FakeDataProtector();
            var settings          = new TwitterSettings
            {
                AccessToken       = "370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb",
                AccessTokenSecret = "LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE",
                ConsumerKey       = "xvz1evFS4wEEPTGEFPHBog",
                ConsumerSecret    = "kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw"
            };

            settings.AccessTokenSecret = fakeDataProtector.Protect(settings.AccessTokenSecret);
            settings.ConsumerSecret    = fakeDataProtector.Protect(settings.ConsumerSecret);

            var signinSettings = new TwitterSigninSettings
            {
                CallbackPath = null
            };

            mockSiteService = Mock.Of <ISiteService>(ss =>
                                                     ss.GetSiteSettingsAsync() == Task.FromResult(
                                                         Mock.Of <ISite>(s => s.Properties == JObject.FromObject(new { TwitterSettings = settings, TwitterSignInSettings = signinSettings }))
                                                         )
                                                     );

            mockDataProtectionProvider = Mock.Of <IDataProtectionProvider>(dpp =>
                                                                           dpp.CreateProtector(It.IsAny <string>()) == fakeDataProtector
                                                                           );

            var ticks = 13186229580000000 + 621355968000000000;

            mockHttpMessageHandler = new Mock <TwitterClientMessageHandler>(
                Mock.Of <IClock>(i => i.UtcNow == new DateTime(ticks)),
                mockSiteService, mockDataProtectionProvider);
        }
Beispiel #21
0
    public override void LoadWidget()
    {
        TwitterSettings settings = GetTwitterSettings();

        if (settings.AccountUrl != null && !string.IsNullOrEmpty(settings.FollowMeText))
        {
            hlTwitterAccount.NavigateUrl = settings.AccountUrl.ToString();
            hlTwitterAccount.Text        = settings.FollowMeText;
        }

        if (settings.FeedUrl != null)
        {
            if (HttpRuntime.Cache[TWITTER_FEEDS_CACHE_KEY] == null)
            {
                XmlDocument doc = GetLastFeed();
                if (doc != null)
                {
                    HttpRuntime.Cache[TWITTER_FEEDS_CACHE_KEY] = doc.OuterXml;
                }
            }

            if (HttpRuntime.Cache[TWITTER_FEEDS_CACHE_KEY] != null)
            {
                string      xml = (string)HttpRuntime.Cache[TWITTER_FEEDS_CACHE_KEY];
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(xml);
                BindFeed(doc, settings.MaxItems);
            }

            if (DateTime.Now > settings.LastModified.AddMinutes(settings.PollingInterval))
            {
                settings.LastModified = DateTime.Now;
                BeginGetFeed(settings.FeedUrl);
            }
        }
    }
Beispiel #22
0
        public static async Task <TwitterSettings> ImportTwitterSettings()
        {
            string          FilePath        = Path.Combine(Constants.AppFolder(Constants.AppDirectory.DataTwitterSettings));
            TwitterSettings TwitterSettings = new TwitterSettings();

            if (!String.IsNullOrEmpty(FilePath))
            {
                // First see if we have the file we want where we want it. To do that, we need to get the filepath to our app folder in my documents
                if (Directory.Exists(FilePath))
                {
                    // We can only do this because the directory exists
                    // Now check if the file exists
                    string ourfilepath = Path.Combine(FilePath, "TwSettings.csv");

                    // Get trade info, and Account balance
                    if (File.Exists(ourfilepath))
                    {
                        // handle backward compatibility: if new fields were added, the CsvReader cannot find these and throws a CsvHelper.ValidationException.
                        // in this case, we try to load the csv with our compatibility class that we copied before the additional fields were added and this shoudl go fine.
                        // after that we create the new instances out of the old values and add default values for the new fields.
                        try
                        {
                            using (var reader = new CsvReader(new StreamReader(ourfilepath), CultureInfo.InvariantCulture))
                            {
                                TwitterSettings = reader.GetRecords <TwitterSettings>().FirstOrDefault();
                            }
                        }
                        catch (CsvHelper.ValidationException valex)
                        {
                        }
                    }
                }
            }

            return(TwitterSettings);
        }
        /// <summary>
        /// Gets the twitter settings.
        /// </summary>
        /// <returns>
        /// The twitter settings.
        /// </returns>
        private TwitterSettings GetTwitterSettings()
        {
            var twitterSettings = Blog.CurrentInstance.Cache[TwitterSettingsCacheKey] as TwitterSettings;

            if (twitterSettings != null)
            {
                return(twitterSettings);
            }

            twitterSettings = new TwitterSettings();

            // Defaults
            var          maxItems        = 3;
            var          pollingInterval = 15;
            const string FollowMeText    = "Follow me";

            var settings = this.GetSettings();

            if (settings.ContainsKey("accounturl") && !string.IsNullOrEmpty(settings["accounturl"]))
            {
                Uri accountUrl;
                Uri.TryCreate(settings["accounturl"], UriKind.Absolute, out accountUrl);
                twitterSettings.AccountUrl = accountUrl;
            }

            if (settings.ContainsKey("feedurl") && !string.IsNullOrEmpty(settings["feedurl"]))
            {
                Uri feedUrl;
                Uri.TryCreate(settings["feedurl"], UriKind.Absolute, out feedUrl);
                twitterSettings.FeedUrl = feedUrl;
            }

            if (settings.ContainsKey("pollinginterval") && !string.IsNullOrEmpty(settings["pollinginterval"]))
            {
                int tempPollingInterval;
                if (int.TryParse(settings["pollinginterval"], out tempPollingInterval))
                {
                    if (tempPollingInterval > 0)
                    {
                        pollingInterval = tempPollingInterval;
                    }
                }
            }

            twitterSettings.PollingInterval = pollingInterval;

            if (settings.ContainsKey("maxitems") && !string.IsNullOrEmpty(settings["maxitems"]))
            {
                int tempMaxItems;
                if (int.TryParse(settings["maxitems"], out tempMaxItems))
                {
                    if (tempMaxItems > 0)
                    {
                        maxItems = tempMaxItems;
                    }
                }
            }

            twitterSettings.MaxItems = maxItems;

            twitterSettings.FollowMeText = settings.ContainsKey("followmetext") &&
                                           !string.IsNullOrEmpty(settings["followmetext"])
                                               ? settings["followmetext"]
                                               : FollowMeText;

            Blog.CurrentInstance.Cache[TwitterSettingsCacheKey] = twitterSettings;

            return(twitterSettings);
        }
Beispiel #24
0
    private TwitterSettings GetTwitterSettings()
    {
        TwitterSettings twitterSettings = HttpRuntime.Cache[TWITTER_SETTINGS_CACHE_KEY] as TwitterSettings;

        if (twitterSettings != null)
        {
            return(twitterSettings);
        }

        twitterSettings = new TwitterSettings();

        // Defaults
        int    maxItems        = 3;
        int    pollingInterval = 15;
        string followMeText    = "Follow me";
        Uri    accountUrl;
        Uri    feedUrl;

        StringDictionary settings = GetSettings();

        if (settings.ContainsKey("accounturl") && !string.IsNullOrEmpty(settings["accounturl"]))
        {
            Uri.TryCreate(settings["accounturl"], UriKind.Absolute, out accountUrl);
            twitterSettings.AccountUrl = accountUrl;
        }

        if (settings.ContainsKey("feedurl") && !string.IsNullOrEmpty(settings["feedurl"]))
        {
            Uri.TryCreate(settings["feedurl"], UriKind.Absolute, out feedUrl);
            twitterSettings.FeedUrl = feedUrl;
        }

        if (settings.ContainsKey("pollinginterval") && !string.IsNullOrEmpty(settings["pollinginterval"]))
        {
            int tempPollingInterval;
            if (int.TryParse(settings["pollinginterval"], out tempPollingInterval))
            {
                if (tempPollingInterval > 0)
                {
                    pollingInterval = tempPollingInterval;
                }
            }
        }
        twitterSettings.PollingInterval = pollingInterval;

        if (settings.ContainsKey("maxitems") && !string.IsNullOrEmpty(settings["maxitems"]))
        {
            int tempMaxItems;
            if (int.TryParse(settings["maxitems"], out tempMaxItems))
            {
                if (tempMaxItems > 0)
                {
                    maxItems = tempMaxItems;
                }
            }
        }
        twitterSettings.MaxItems = maxItems;

        if (settings.ContainsKey("followmetext") && !string.IsNullOrEmpty(settings["followmetext"]))
        {
            twitterSettings.FollowMeText = settings["followmetext"];
        }
        else
        {
            twitterSettings.FollowMeText = followMeText;
        }

        HttpRuntime.Cache[TWITTER_SETTINGS_CACHE_KEY] = twitterSettings;

        return(twitterSettings);
    }
 public TwitterAuthenticationInitializer(TwitterSettings settings, ILogger <TwitterAuthenticationInitializer> logger)
 {
     _settings = settings;
     _logger   = logger;
 }
Beispiel #26
0
 public TwitterService(TwitterSettings twitterSettings)
 {
     _twitterSettings = twitterSettings;
 }
Beispiel #27
0
 public Twitter()
 {
     Settings = new TwitterSettings();
     Initalize();
     NavigateTo(Url);
 }
Beispiel #28
0
 public TwitterController(TwitterSettings twitterSettings, ISettingService settingService)
 {
     _twitterSettings = twitterSettings;
     _settingService  = settingService;
 }
 public TwitterStreamingApiAdapter(TwitterSettings twitterSettings)
 {
     this.twitterSettings = twitterSettings ?? throw new ArgumentNullException("twitterSettings");
 }
Beispiel #30
0
 public TwitterAlertClient(
     IOptions <TwitterSettings> twitterSettings)
 {
     _logger          = Log.ForContext("SourceContext", nameof(TwitterAlertClient));
     _twitterSettings = twitterSettings.Value;
 }
Beispiel #31
0
 public static void Terminate()
 {
     account = null;
     settings = null;
 }
 public TwitterSettingsEditor()
 {
     TwitterSettings.RegisterChangeEventCallback(this.SettingsChanged);
 }
Beispiel #33
0
        public ValidationFailure Test(TwitterSettings settings)
        {
            try
            {
                var body = "Sonarr: Test Message @ " + DateTime.Now;

                SendNotification(body, settings);
            }
            catch (Exception ex)
            {
                _logger.Error(ex, "Unable to send test message: " + ex.Message);
                return new ValidationFailure("Host", "Unable to send test message");
            }
            return null;
        }
Beispiel #34
0
 public TwitterQuery(IOptions <TwitterSettings> settings)
 {
     this.settings = settings.Value;
 }