public static async Task CallDifferenceHandlers(int fileType, DifferenceType differenceType, object[] parameters)
        {
            // Get the handlers
            SortedList <int, MethodInfo> methodInfos = HandlerMapper.GetHandlers((int)fileType, differenceType);

            // Loop over every handler
            foreach (MethodInfo methodInfo in methodInfos.Values)
            {
                await DiscordBot.LoggingChannel.SendMessageAsync("**[BCAT]** Calling " + methodInfo.DeclaringType.Name + "." + methodInfo.Name + "()");

                try
                {
                    // Invoke the method
                    object returnValue = methodInfo.Invoke(null, parameters);

                    // Check the return value
                    if (returnValue != null && returnValue is Task)
                    {
                        await(Task) returnValue;
                    }
                }
                catch (Exception exception)
                {
                    // Notify the logging channel
                    await DiscordUtil.HandleException((exception is TargetInvocationException)?((TargetInvocationException)exception).InnerException : exception, $"in ``{methodInfo.DeclaringType.Name}.{methodInfo.Name}()``");
                }
            }
        }
Beispiel #2
0
        public async Task Execute(IJobExecutionContext context)
        {
            // Get the values from the JobDataMap
            JobDataMap dataMap        = context.JobDetail.JobDataMap;
            string     namePrefix     = dataMap.GetString(ARCHIVAL_DATA_PREFIX);
            string     id             = dataMap.GetString(ARCHIVAL_DATA_ID);
            string     unformattedUrl = dataMap.GetString(ARCHIVAL_DATA_URL);

            // Format the S3 path
            string s3Path = $"/smash/{namePrefix}/{id}/page";

            try
            {
                // Loop over every Language
                foreach (Language language in Nintendo.SmashUltimate.Bcat.Container.LanguageOrder)
                {
                    // Get the URL for this language
                    string url = unformattedUrl.Replace("{$lang}", language.GetCode());

                    // Perform an HTTP request
                    using (HttpResponseMessage response = await httpClient.GetAsync(url))
                        using (HttpContent content = response.Content)
                        {
                            // Check for a success
                            if (!response.IsSuccessStatusCode)
                            {
                                // Check for 404
                                if (response.StatusCode == HttpStatusCode.NotFound)
                                {
                                    // Log
                                    await DiscordBot.LoggingChannel.SendMessageAsync($"**[ArchivalJob]** {language} for {namePrefix}_{id} not found");

                                    continue;
                                }

                                // Unknown error
                                throw new Exception("Archival failure on HTTP request (" + response.StatusCode + ")");
                            }

                            // Get the content
                            byte[] rawContent = await content.ReadAsByteArrayAsync();

                            // Write the data to S3
                            S3Api.TransferFile(rawContent, s3Path, language.GetCode() + ".html");

                            await DiscordBot.LoggingChannel.SendMessageAsync($"**[ArchivalJob]** Downloaded {language} for {namePrefix}_{id}");
                        }
                }
            }
            catch (Exception exception)
            {
                // Notify the logging channel
                await DiscordUtil.HandleException(exception, $"in ``ContainerArchivalJob``");
            }
        }
Beispiel #3
0
        public async Task Execute(IJobExecutionContext context)
        {
            try
            {
                // Log that we're about to begin a check
                await DiscordBot.LoggingChannel.SendMessageAsync("**[BCAT]** Beginning check");

                // Download the latest Topic
                Topic topic = await BcatApi.GetDataTopic(Program.TITLE_ID, Program.PASSPHRASE);

                // Create the target folder name
                string targetFolder = string.Format(Program.LOCAL_OLD_DATA_DIRECTORY, DateTime.Now.ToString(Program.FOLDER_DATE_TIME_FORMAT));

                // Check if this the first run
                if (!Configuration.LoadedConfiguration.FirstRunCompleted)
                {
                    // Log that this is the first run of BCAT
                    await DiscordBot.LoggingChannel.SendMessageAsync("**[BCAT]** First run");

                    // Download all data
                    Dictionary <string, byte[]> downloadedData = await BcatCheckerUtils.DownloadAllData(topic, Program.TITLE_ID, Program.PASSPHRASE, targetFolder);

                    // Loop over all data
                    foreach (KeyValuePair <string, byte[]> pair in downloadedData)
                    {
                        // Get the FileType
                        FileType fileType = FileTypeExtensions.GetTypeFromName(pair.Key);

                        // Check if this is a container
                        if (fileType.IsContainer())
                        {
                            // Create a Container instance
                            Nintendo.SmashUltimate.Bcat.Container container = CreateSmashContainerInstance(fileType, pair.Value);

                            // Add this to the container cache
                            ContainerCache.AddFile(container, Path.GetFileName(pair.Key), pair.Value);
                        }
                        else
                        {
                            // Write this file out to the common file cache
                            File.WriteAllBytes(Path.Combine(Program.LOCAL_COMMON_CACHE_DIRECTORY, Path.GetFileName(pair.Key)), pair.Value);
                        }
                    }

                    // Save the configuration
                    Configuration.LoadedConfiguration.FirstRunCompleted = true;
                    Configuration.LoadedConfiguration.Write();

                    // Write out the topic
                    File.WriteAllBytes(Program.LOCAL_LAST_TOPIC, MessagePackSerializer.Serialize(topic));

                    // Log that we're about to begin a check
                    await DiscordBot.LoggingChannel.SendMessageAsync("**[BCAT]** First run complete");

                    return;
                }

                // Load the old Topic
                Topic oldTopic = MessagePackSerializer.Deserialize <Topic>(File.ReadAllBytes(Program.LOCAL_LAST_TOPIC));

#if DEBUG
                if (!Configuration.LoadedConfiguration.IsProduction)
                {
                    /*foreach (Bcat.Directory dir in oldTopic.Directories)
                     * {
                     *  if (dir.Name == "line_news")
                     *  {
                     *      Data dbgData = dir.Data.FirstOrDefault();
                     *      if (dbgData == null)
                     *      {
                     *          continue;
                     *      }
                     *      dir.Data.Remove(dbgData);
                     *      //dbgData.Digest = "deadbeef";
                     *  }
                     * }*/
                }
#endif

                // Get the differences
                List <KeyValuePair <DifferenceType, string> > differences = BcatCheckerUtils.GetTopicChanges(oldTopic, topic);

                // Check if there aren't any
                if (differences.Count == 0)
                {
                    // Nothing to do here
                    goto finished;
                }

                // Download all data
                Dictionary <string, byte[]> data = await BcatCheckerUtils.DownloadAllData(topic, Program.TITLE_ID, Program.PASSPHRASE, targetFolder);

                // Loop over every difference
                foreach (KeyValuePair <DifferenceType, string> pair in differences)
                {
                    // Log the difference
                    await DiscordBot.LoggingChannel.SendMessageAsync("**[BCAT]** diff: ``" + pair.Value + "`` (" + pair.Key.ToString() + ")");

                    // Get the FileType
                    FileType fileType = FileTypeExtensions.GetTypeFromName(pair.Value);

                    // Declare a variable to hold the method parameters
                    object[] parameters;

                    if (pair.Key == DifferenceType.Added)
                    {
                        // Get the raw file
                        byte[] rawFile = data[pair.Value];

                        // Check if this is a Container
                        if (fileType.IsContainer())
                        {
                            // Create a Container instance
                            Nintendo.SmashUltimate.Bcat.Container addedContainer = CreateSmashContainerInstance(fileType, data[pair.Value]);

                            // Add this to the container cache
                            ContainerCache.AddFile(addedContainer, Path.GetFileName(pair.Value), rawFile);

                            // Set the method parameters
                            parameters = new object[] { addedContainer };
                        }
                        else
                        {
                            // Write this file out to the common file cache
                            File.WriteAllBytes(Path.Combine(Program.LOCAL_COMMON_CACHE_DIRECTORY, Path.GetFileName(pair.Value)), data[pair.Value]);

                            // Set the method parameters
                            parameters = new object[] { rawFile };
                        }
                    }
                    else if (pair.Key == DifferenceType.Changed)
                    {
                        // Get the raw file
                        byte[] rawFile = data[pair.Value];

                        // Check if this is a Container
                        if (fileType.IsContainer())
                        {
                            // Create a Container instance
                            Nintendo.SmashUltimate.Bcat.Container addedContainer = CreateSmashContainerInstance(fileType, data[pair.Value]);

                            // Overwrite this to the container cache
                            Nintendo.SmashUltimate.Bcat.Container previousContainer = ContainerCache.OverwriteFile(addedContainer, Path.GetFileName(pair.Value), rawFile);

                            // Set the method parameters
                            parameters = new object[] { previousContainer, addedContainer };
                        }
                        else
                        {
                            // Construct the commoon cache path
                            string path = Path.Combine(Program.LOCAL_COMMON_CACHE_DIRECTORY, Path.GetFileName(pair.Value));

                            // Load the old file
                            byte[] previousRawFile = File.ReadAllBytes(path);

                            // Write this file out to the common file cache
                            File.WriteAllBytes(path, data[pair.Value]);

                            // Set the method parameters
                            parameters = new object[] { previousRawFile, rawFile };
                        }
                    }
                    else // Removed
                    {
                        // TODO: discord print
                        continue;
                    }

                    // Call every difference handler
                    await BcatCheckerUtils.CallDifferenceHandlers((int)fileType, pair.Key, parameters);
                }

                // Write out the Topic
                File.WriteAllBytes(Program.LOCAL_LAST_TOPIC, MessagePackSerializer.Serialize(topic));

finished:
                await DiscordBot.LoggingChannel.SendMessageAsync("**[BCAT]** Check complete");
            }
            catch (Exception exception)
            {
                // Notify the logging channel
                await DiscordUtil.HandleException(exception, $"in ``BcatCheckerJob``");
            }
        }
Beispiel #4
0
        public async Task Execute(IJobExecutionContext context)
        {
            try
            {
                if (Configuration.LoadedConfiguration.FirstRunCompleted)
                {
                    throw new Exception("Attempting to do first run more than once");
                }

                foreach (KeyValuePair <RomType, BcatPair> bcatPairEntry in Program.BcatPairs)
                {
                    // Log that we're about to begin a check
                    await DiscordBot.LoggingChannel.SendMessageAsync("**[BCAT]** Beginning topic download for " + bcatPairEntry.Key.ToString());

                    // Download the latest Topic
                    Topic topic = await BcatApi.GetDataTopic(bcatPairEntry.Value.TitleId, bcatPairEntry.Value.Passphrase);

                    // Create the target folder name
                    string targetFolder = string.Format(Program.LOCAL_OLD_DATA_DIRECTORY, DateTime.Now.ToString(Program.FOLDER_DATE_TIME_FORMAT), bcatPairEntry.Key.ToString());

                    // Download all data
                    Dictionary <string, byte[]> downloadedData = await BcatCheckerUtils.DownloadAllData(topic, bcatPairEntry.Value.TitleId, bcatPairEntry.Value.Passphrase, targetFolder);

                    // Loop over all data
                    foreach (KeyValuePair <string, byte[]> dataPair in downloadedData)
                    {
                        // Get the FileType
                        FileType fileType = FileTypeExtensions.GetTypeFromFilePath(dataPair.Key);

                        // Populate the FileCache directories based on the FileType
                        string path;
                        switch (fileType)
                        {
                        case FileType.VersusSetting:
                            path = string.Format(FileCache.VERSUS_SETTING_PATH, bcatPairEntry.Key.ToString());
                            break;

                        case FileType.CoopSetting:
                            // Only write the CoopSetting file once
                            if (bcatPairEntry.Key != RomType.NorthAmerica)
                            {
                                continue;
                            }

                            path = FileCache.COOP_SETTING_PATH;

                            break;

                        case FileType.FestivalByaml:
                            // Deserialize the byaml to get the ID
                            dynamic byaml = ByamlLoader.GetByamlDynamic(dataPair.Value);

                            // Generate the path
                            path = string.Format(FileCache.FESTIVAL_SETTING_PATH, bcatPairEntry.Key.ToString(), byaml["FestivalId"]);

                            break;

                        default:
                            continue;
                        }

                        // Create the directories if needed
                        System.IO.Directory.CreateDirectory(Path.GetDirectoryName(path));

                        // Write the file
                        File.WriteAllBytes(path, dataPair.Value);
                    }

                    // Write out the topic
                    File.WriteAllBytes(string.Format(Program.LOCAL_LAST_TOPIC, bcatPairEntry.Key.ToString()), MessagePackSerializer.Serialize(topic));

                    // Set the last data download directory
                    (Configuration.LoadedConfiguration as JelonzoBotConfiguration).LastDownloadPaths[bcatPairEntry.Key] = targetFolder;

                    // Log that the first run is done
                    await DiscordBot.LoggingChannel.SendMessageAsync($"**[BCAT]** First run complete for {bcatPairEntry.Key.ToString()}");
                }

                // Save the configuration
                Configuration.LoadedConfiguration.FirstRunCompleted = true;
                Configuration.LoadedConfiguration.Write();

                // Initialize the FileCache
                FileCache.Initialize();
            }
            catch (Exception exception)
            {
                // Notify the logging channel
                await DiscordUtil.HandleException(exception, $"in ``BcatCheckerJob``");
            }

            await QuartzScheduler.ScheduleJob <BcatCheckerJob>("Normal", Configuration.LoadedConfiguration.JobSchedules["Bcat"]);
        }
Beispiel #5
0
        public async Task Execute(IJobExecutionContext context)
        {
            try
            {
                // Log that we're about to begin uploading data
                await DiscordBot.LoggingChannel.SendMessageAsync("**[RomDataUploadJob]** Beginning ROM data upload");

                // Create a list of paths whose cache needs to be cleared
                List <string> clearPaths = new List <string>();

                // Create the MSBT S3 path format string
                string msbtS3BasePath = "/splatoon/blitz_rom/Message/CommonMsg_{0}";

                // Loop over every language
                foreach (Language language in BlitzUtil.SupportedLanguages)
                {
                    // Log the language
                    await DiscordBot.LoggingChannel.SendMessageAsync($"**[RomDataUploadJob]** Uploading {language.ToString()}'s MSBTs");

                    // Get the MsbtHolder
                    MsbtHolder msbtHolder = BlitzLocalizer.MsbtHolders[language];

                    // Loop over every MSBT
                    foreach (KeyValuePair <string, Dictionary <string, string> > pair in msbtHolder.Msbts)
                    {
                        // Construct the path
                        string msbtPath = string.Format(msbtS3BasePath, language.GetSeadCode());

                        // Construct the file name
                        string fileName = $"{pair.Key}.json";

                        // Serialize to JSON
                        string json = JsonConvert.SerializeObject(pair.Value);

                        // Upload to S3
                        S3Api.TransferFile(Encoding.UTF8.GetBytes(json), msbtPath, fileName, "application/json");

                        // Add to the cache list
                        clearPaths.Add($"{msbtPath}/{fileName}");
                    }
                }

                // Log MSBT upload
                await DiscordBot.LoggingChannel.SendMessageAsync("**[RomDataUploadJob]** Uploading Mush");

                // Create the Mush S3 path string
                string mushS3Path = "/splatoon/blitz_rom/Mush";

                // Get every file in Mush
                foreach (string path in RomResourceLoader.GetFilesInDirectory("/Mush"))
                {
                    // Get the BYAML
                    dynamic byaml = ByamlLoader.GetByamlDynamic(path);

                    // Construct the file name
                    string fileName = $"{Path.GetFileNameWithoutExtension(path)}.json";

                    // Serialize to JSON
                    string json = JsonConvert.SerializeObject(byaml);

                    // Upload to S3
                    S3Api.TransferFile(Encoding.UTF8.GetBytes(json), mushS3Path, fileName, "application/json");

                    // Add to the paths to clear
                    clearPaths.Add($"{mushS3Path}/{fileName}");
                }

                // Log CDN cache purge starting
                await DiscordBot.LoggingChannel.SendMessageAsync($"**[RomDataUploadJob]** Requesting CDN cache purge ({clearPaths.Count} of {clearPaths.Count} files left)");

                IEnumerable <string> pathsEnumerable = (IEnumerable <string>)clearPaths;

                while (pathsEnumerable.Any())
                {
                    // Tell DigitalOcean to clear the cache
                    await DoApi.SendRequest(new DoCdnCachePurgeRequest(Configuration.LoadedConfiguration.DoConfig.EndpointId, pathsEnumerable.Take(15).ToList()));

                    // Advance to the next set
                    pathsEnumerable = pathsEnumerable.Skip(15);

                    // Log files left
                    await DiscordBot.LoggingChannel.SendMessageAsync($"**[RomDataUploadJob]** Requesting CDN cache purge ({pathsEnumerable.Count()} of {clearPaths.Count} files left)");
                }

                // Write the app version
                await DiscordBot.LoggingChannel.SendMessageAsync("**[RomDataUploadJob]** Saving new ROM version to configuration");

                (Configuration.LoadedConfiguration as JelonzoBotConfiguration).RomConfig.LastRomVersion = (int)context.JobDetail.JobDataMap["version"];
                Configuration.LoadedConfiguration.Write();

                // Log that it's complete
                await DiscordBot.LoggingChannel.SendMessageAsync("**[RomDataUploadJob]** ROM data upload complete");
            }
            catch (Exception e)
            {
                await DiscordUtil.HandleException(e, "in ``RomDataUploadJob``");
            }
        }
        public async Task Execute(IJobExecutionContext context)
        {
            try
            {
                foreach (KeyValuePair <RomType, BcatPair> bcatPairEntry in Program.BcatPairs)
                {
                    // Log that we're about to begin a check
                    await DiscordBot.LoggingChannel.SendMessageAsync("**[BCAT]** Beginning topic download for " + bcatPairEntry.Key.ToString());

                    // Download the latest Topic
                    Topic topic = await BcatApi.GetDataTopic(bcatPairEntry.Value.TitleId, bcatPairEntry.Value.Passphrase);

                    // Create the target folder name
                    string targetFolder = string.Format(Program.LOCAL_OLD_DATA_DIRECTORY, DateTime.Now.ToString(Program.FOLDER_DATE_TIME_FORMAT), bcatPairEntry.Key.ToString());

                    // Format the old Topic path
                    string oldTopicPath = string.Format(Program.LOCAL_LAST_TOPIC, bcatPairEntry.Key.ToString());

                    // Load the old Topic
                    Topic oldTopic = MessagePackSerializer.Deserialize <Topic>(File.ReadAllBytes(oldTopicPath));

    #if DEBUG
                    if (!Configuration.LoadedConfiguration.IsProduction)
                    {
                        /*foreach (Nintendo.Bcat.Directory dir in oldTopic.Directories)
                         * {
                         *  if (dir.Name == "fesdata")
                         *  {
                         *      Data dbgData = dir.Data.Where(x => x.Name == "Festival.byaml").FirstOrDefault();
                         *      dbgData.Digest = "deadbeef";
                         *  }
                         * }*/
                    }
    #endif

                    // Get the differences
                    List <KeyValuePair <DifferenceType, string> > differences = BcatCheckerUtils.GetTopicChanges(oldTopic, topic);

                    // Check if there aren't any
                    if (differences.Count == 0)
                    {
                        // Nothing to do here
                        goto finished;
                    }

                    // Download all data
                    Dictionary <string, byte[]> data = await BcatCheckerUtils.DownloadAllData(topic, bcatPairEntry.Value.TitleId, bcatPairEntry.Value.Passphrase, targetFolder);

                    // Loop over every difference
                    foreach (KeyValuePair <DifferenceType, string> differencePair in differences)
                    {
                        // Log the difference
                        await DiscordBot.LoggingChannel.SendMessageAsync("**[BCAT]** diff: ``" + differencePair.Value + "`` (" + differencePair.Key.ToString() + ")");

                        // Get the FileType
                        FileType fileType = FileTypeExtensions.GetTypeFromFilePath(differencePair.Value);

                        // Create a ByamlSerializer instance
                        ByamlSerializer serializer = new ByamlSerializer(new ByamlSerializerSettings()
                        {
                            ByteOrder    = ByteOrder.LittleEndian,
                            SupportPaths = false,
                            Version      = ByamlVersion.Version1
                        });

                        // Create the difference handler parameters based off the FileType and difference type
                        object[] parameters;

                        if (differencePair.Key != DifferenceType.Removed)
                        {
                            // Get the raw file
                            byte[] rawFile = data[differencePair.Value];

                            // Deserialize the object from byaml if necessary
                            object deserializedObject;
                            using (MemoryStream memoryStream = new MemoryStream(rawFile))
                            {
                                switch (fileType)
                                {
                                case FileType.VersusSetting:
                                    deserializedObject = serializer.Deserialize <VersusSetting>(memoryStream);
                                    break;

                                case FileType.CoopSetting:
                                    deserializedObject = serializer.Deserialize <CoopSetting>(memoryStream);
                                    break;

                                case FileType.FestivalByaml:
                                    deserializedObject = serializer.Deserialize <FestivalSetting>(memoryStream);
                                    break;

                                default:
                                    deserializedObject = data[differencePair.Value];
                                    break;
                                }
                            }

                            if (differencePair.Key == DifferenceType.Added)
                            {
                                parameters = new object[] { bcatPairEntry.Key, data, deserializedObject, rawFile };
                            }
                            else // Changed
                            {
                                // Get the previous file
                                object previousFile;
                                switch (fileType)
                                {
                                case FileType.VersusSetting:
                                    previousFile = FileCache.GetVersusSettingForRomType(bcatPairEntry.Key);
                                    break;

                                case FileType.CoopSetting:
                                    previousFile = FileCache.GetCoopSetting();
                                    break;

                                case FileType.FestivalByaml:
                                    previousFile = FileCache.GetLatestFestivalSettingForRomType(bcatPairEntry.Key);
                                    break;

                                default:
                                    // Construct the previous file path
                                    string previousPath = Path.Combine((Configuration.LoadedConfiguration as JelonzoBotConfiguration).LastDownloadPaths[bcatPairEntry.Key], differencePair.Value.Replace('/', Path.DirectorySeparatorChar));

                                    // Load it
                                    previousFile = File.ReadAllBytes(previousPath);;
                                    break;
                                }

                                // Create the parameters
                                parameters = new object[] { bcatPairEntry.Key, data, previousFile, deserializedObject, rawFile };
                            }
                        }
                        else
                        {
                            parameters = new object[] { bcatPairEntry.Key, data };
                        }

                        // Call every difference handler
                        await BcatCheckerUtils.CallDifferenceHandlers((int)fileType, differencePair.Key, parameters);
                    }

                    // Write out the Topic
                    File.WriteAllBytes(oldTopicPath, MessagePackSerializer.Serialize(topic));

                    // Set the last download path
                    (Configuration.LoadedConfiguration as JelonzoBotConfiguration).LastDownloadPaths[bcatPairEntry.Key] = targetFolder;

finished:
                    await DiscordBot.LoggingChannel.SendMessageAsync("**[BCAT]** Check complete for " + bcatPairEntry.Key.ToString());
                }
            }
            catch (Exception exception)
            {
                // Notify the logging channel
                await DiscordUtil.HandleException(exception, $"in ``BcatCheckerJob``");
            }
        }
        public async Task Execute(IJobExecutionContext context)
        {
            try {
                // Run app-specific boot tasks
                await RunAppSpecificBootTasks();

                // Run one-time tasks
                await DiscordBot.LoggingChannel.SendMessageAsync($"**[BootHousekeepingJob]** Running one-time tasks");

                foreach (Type type in Assembly.GetExecutingAssembly().GetTypes().Where(x => x.IsSubclassOf(typeof(OneTimeTask)) && !x.IsAbstract))
                {
                    // Create a new instance and run it
                    await((OneTimeTask)Activator.CreateInstance(type)).RunImpl();
                }

                await DiscordBot.LoggingChannel.SendMessageAsync($"**[BootHousekeepingJob]** Processing joined/left guilds");

                // Get a list of guilds
                IReadOnlyCollection <SocketGuild> socketGuilds = DiscordBot.GetGuilds();

                // Get all guild IDs that we have settings for
                List <ulong> configurationGuilds = new List <ulong>();
                foreach (GuildSettings guildSettings in Configuration.LoadedConfiguration.DiscordConfig.GuildSettings)
                {
                    configurationGuilds.Add(guildSettings.GuildId);
                }

                // Get all IDs for guilds that we are in
                List <ulong> currentGuilds = new List <ulong>();
                foreach (SocketGuild socketGuild in DiscordBot.GetGuilds())
                {
                    currentGuilds.Add(socketGuild.Id);
                }

                // Get all the guilds we have joined
                IEnumerable <ulong> joinedGuilds = currentGuilds.Except(configurationGuilds);
                foreach (ulong id in joinedGuilds)
                {
                    // TODO: find a better solution instead of spamming the Welcome message
                    //await DiscordUtil.ProcessJoinedGuild(socketGuilds.Where(guild => guild.Id == id).FirstOrDefault());
                }

                // Get all the guilds we have been removed from
                IEnumerable <ulong> removedGuilds = configurationGuilds.Except(currentGuilds);
                foreach (ulong id in removedGuilds)
                {
                    await DiscordUtil.ProcessLeftGuild(id, null);
                }

                await DiscordBot.LoggingChannel.SendMessageAsync($"**[BootHousekeepingJob]** Saving configuration");

                // Save the configuration
                Configuration.LoadedConfiguration.Write();

                // Schedule the RecurringHousekeepingJob
                await QuartzScheduler.ScheduleJob(TypeUtils.GetSubclassOfType <RecurringHousekeepingJob>(), "Normal", Configuration.LoadedConfiguration.JobSchedules["Recurring"]);

                // Schedule jobs
                await SchedulePostBootJobs();
            }
            catch (Exception e)
            {
                await DiscordUtil.HandleException(e, "in ``BootHousekeepingJob``");
            }
        }