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:
parent
b5011ee5d2
commit
2688d5f5e7
1 changed files with 10 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue