protected override async Task Init()
        {
            await LogAsync(LogLevel.Message, $"Initializing {this.GetType().Name}...");

            authLoopToken = new CancellationTokenSource();

            LogModule = await GetModuleAsync <LogModule>();

            RoleModule = await GetModuleAsync <RoleModule>();

            DatabaseModule = await GetModuleAsync <DatabaseModule>();

            ApiModule = await GetModuleAsync <ApiModule>();

            JobModule = await GetModuleAsync <JobModule>();

            await JobModule.RegisterJobAsync <CheckupJob>(CheckupJobMethod);

            if (Config.NameVerificationLoop)
            {
                await JobModule.RegisterJobAsync <VerifyJob>(VerifyJobMethod);

                if (!await JobModule.JobExistsAsync <VerifyJob>(x => x.Creator == "RecruitmentModule"))
                {
                    await JobModule.AddJobAsync(new VerifyJob("RecruitmentModule", new TimeSpan(Config.NameVerificationInterval, 0, 0)), RoundDateTime(DateTime.UtcNow));
                }
            }

            await LogAsync(LogLevel.Message, "Starting auth loop...");
            await StartSocketServer(authLoopToken.Token);
        }
        protected override async Task Init()
        {
            await LogAsync(YahurrFramework.Enums.LogLevel.Message, $"Initializing {this.GetType().Name}...");

            NotificationParser = new NotificationParser.NotificationParser(Config);

            JobModule = await GetModuleAsync <JobModule>();

            await JobModule.RegisterJobAsync <NotificationJob>(SayNotificationJob);
        }
		protected override async Task Init()
		{
			await LogAsync(LogLevel.Message, $"Initializing {this.GetType().Name}...");

			DatabaseModule = await GetModuleAsync<DatabaseModule>();
			LogModule = await GetModuleAsync<LogModule>();
			JobModule = await GetModuleAsync<JobModule>();

			if (Config.RoleCheckLoop)
			{
				await JobModule.RegisterJobAsync<VerifyRoleJob>(VerifyRoleJob);
				if (!await JobModule.JobExistsAsync<VerifyRoleJob>(x => x.Creator == "RoleModule"))
					await JobModule.AddJobAsync(new VerifyRoleJob("RoleModule", new TimeSpan(Config.RoleCheckInterval, 0, 0)), RoundDateTime(DateTime.UtcNow));
			}
		}
Ejemplo n.º 4
0
        protected override async Task Init()
        {
            ApiModule = await GetModuleAsync <ApiModule>();

            JobModule = await GetModuleAsync <JobModule>();

            if (await ExistsAsync("CalendarLastEventChecked"))
            {
                lastCheckedEvent = await LoadAsync <DateTime>("CalendarLastEventChecked");
            }

            await JobModule.RegisterJobAsync <CalendarUpdateJob>(CalendarUpdateJob);

            if (!await JobModule.JobExistsAsync <CalendarUpdateJob>(x => x.Creator == "CalendarModule"))
            {
                await JobModule.AddJobAsync(new CalendarUpdateJob("CalendarModule", new TimeSpan(Config.CalendarCheckInterval, 0, 0)));
            }
        }
Ejemplo n.º 5
0
        public async Task MoonList()
        {
            StringBuilder reply = new StringBuilder();

            reply.Append("Scheduled moons:\n");

            List <MoonJob> jobs = await JobModule.GetJobsAsync <MoonJob>();

            for (int i = 0; i < jobs.Count; i++)
            {
                MoonJob  job      = jobs[i];
                DateTime callTime = JobModule.GetNextCall(job);

                reply.Append($"	{i}: {job.Moon} will pop on {callTime.ToString("dd/MM HH:mm:ss")}\n");
            }

            if (jobs.Count <= 0)
            {
                await RespondAsync("No moons listed.", false, false);
            }

            await RespondAsync($"```{reply}```", false, false);
        }