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

task (task)

Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
This commit is contained in:
Macintxsh 2024-04-01 21:46:56 +03:00
parent b5011ee5d2
commit 2688d5f5e7
Signed by: mctaylors
GPG key ID: 7181BEBE676903C1

View file

@ -78,7 +78,7 @@ public sealed class GuildDataService : BackgroundService
var settingsPath = $"{path}/Settings.json";
var scheduledEventsPath = $"{path}/ScheduledEvents.json";
MigrateGuildData(guildId, path);
await MigrateGuildData(guildId, path, ct);
Directory.CreateDirectory(path);
@ -155,7 +155,7 @@ public sealed class GuildDataService : BackgroundService
return finalData;
}
private void MigrateGuildData(Snowflake guildId, string newPath)
private async Task MigrateGuildData(Snowflake guildId, string newPath, CancellationToken ct)
{
var oldPath = $"{guildId}";
@ -167,6 +167,14 @@ public sealed class GuildDataService : BackgroundService
_logger.LogInformation("Moved guild data to separate folder: \"{OldPath}\" -> \"{NewPath}\"", oldPath,
newPath);
}
var settings = (await GetData(guildId, ct)).Settings;
if (GuildSettings.Language.Get(settings).Name is "tt-RU")
{
GuildSettings.Language.Set(settings, "ru");
_logger.LogInformation("Switched from unsupported language in \"{GuildID}\": mctaylors-ru -> ru", guildId.Value);
}
}
public async Task<JsonNode> GetSettings(Snowflake guildId, CancellationToken ct = default)