Пример #1
0
        public TranslateLimitsOld(IDocumentStore store, DBLApiService dblApi, int userDailyLimit = 100, int guildDailyLimit = 2000)
        {
            UserDailyLimit  = userDailyLimit;
            GuildDailyLimit = guildDailyLimit;
            DblApi          = dblApi;
            Store           = store;
            timer           = new Timer(
                async _ =>
            {
                if (initialized)
                {
                    if (DateTime.UtcNow > LastFireTime + TimeSpan.FromHours(23))
                    {
                        try
                        {
                            await ClearDailyAsync();
                        }
                        catch (Exception e)
                        {
                            LogHandler.LogMessage("Reset Error:\n" + $"{e}", LogSeverity.Error);
                        }

                        LastFireTime = DateTime.UtcNow;
                    }
                }
            },
                null,
                TimeSpan.Zero,
                TimeSpan.FromHours(1));
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Developer"/> class.
 /// </summary>
 /// <param name="service">
 /// The service.
 /// </param>
 /// <param name="partnerService">
 /// The partner Service.
 /// </param>
 /// <param name="prefix">
 /// The prefix.
 /// </param>
 /// <param name="httpClient">
 /// The http Client.
 /// </param>
 /// <param name="limits">
 /// The limits.
 /// </param>
 public Developer(TimerService service, PartnerService partnerService, PartnerHelper pHelper, IDocumentStore store, PrefixService prefix, HttpClient httpClient, TranslateLimitsNew limits, DBLApiService dblApi)
 {
     timerService   = service;
     prefixService  = prefix;
     PartnerService = partnerService;
     docStore       = store;
     client         = httpClient;
     Limits         = limits;
     PartnerHelper  = pHelper;
     DblApi         = dblApi;
 }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EventHandler"/> class.
        /// </summary>
        /// <param name="client">
        /// The client.
        /// </param>
        /// <param name="homeService">
        /// The home Service.
        /// </param>
        /// <param name="config">
        /// The config.
        /// </param>
        /// <param name="service">
        /// The service.
        /// </param>
        /// <param name="levels">
        /// The levels.
        /// </param>
        /// <param name="channelHelper">
        /// The channel Helper.
        /// </param>
        /// <param name="commandService">
        /// The command service.
        /// </param>
        /// <param name="prefixService">
        /// The prefix Service.
        /// </param>
        public EventHandler(DiscordShardedClient client, TranslateLimitsNew limits, WaitService waits, DBLApiService dblService, TranslateMethodsNew translationMethods, TranslationService translationService, HomeService homeService, ConfigModel config, IServiceProvider service, LevelHelper levels, ChannelHelper channelHelper, CommandService commandService, PrefixService prefixService)
        {
            Client             = client;
            Config             = config;
            Provider           = service;
            CommandService     = commandService;
            prefixOverride     = DatabaseHandler.Settings.UsePrefixOverride;
            PrefixService      = prefixService;
            _ChannelHelper     = channelHelper;
            _LevelHelper       = levels;
            _HomeService       = homeService;
            _Translate         = translationService;
            Limits             = limits;
            Waits              = waits;
            TranslationMethods = translationMethods;
            DBLApi             = dblService;

            CancellationToken = new CancellationTokenSource();
        }