1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-20 00:43:36 +03:00

Resolving issues...

Signed-off-by: Macintosh II <mctaylxrs@outlook.com>
This commit is contained in:
Macintxsh 2023-09-22 14:42:16 +03:00
parent 4c7b80d458
commit 8384413937
Signed by: mctaylors
GPG key ID: 361D326747B61E65

View file

@ -78,7 +78,7 @@ public sealed class GuildDataService : IHostedService
var settingsPath = $"{path}/Settings.json"; var settingsPath = $"{path}/Settings.json";
var scheduledEventsPath = $"{path}/ScheduledEvents.json"; var scheduledEventsPath = $"{path}/ScheduledEvents.json";
await MigrateGuildData(guildId, path); MigrateGuildData(guildId, path);
Directory.CreateDirectory(path); Directory.CreateDirectory(path);
@ -130,17 +130,17 @@ public sealed class GuildDataService : IHostedService
return finalData; return finalData;
} }
private static Task MigrateGuildData(Snowflake guildId, string path) private void MigrateGuildData(Snowflake guildId, string newPath)
{ {
var oldPath = $"{guildId}"; var oldPath = $"{guildId}";
if (Directory.Exists(oldPath)) if (Directory.Exists(oldPath))
{ {
Directory.CreateDirectory($"{path}/.."); Directory.CreateDirectory($"{newPath}/..");
Directory.Move(oldPath, path); Directory.Move(oldPath, newPath);
}
return Task.CompletedTask; _logger.LogInformation($"Migrated GuildData: \"{oldPath}\" -> \"{newPath}\"");
}
} }
public async Task<JsonNode> GetSettings(Snowflake guildId, CancellationToken ct = default) public async Task<JsonNode> GetSettings(Snowflake guildId, CancellationToken ct = default)