forked from TeamInklings/Octobot
Remove mctaylors' version of the Russian language (#297)
Some checks failed
Publish and deploy / Upload Octobot to production (push) Has been cancelled
Some checks failed
Publish and deploy / Upload Octobot to production (push) Has been cancelled
295 PR/issues ~(not 300, however)~ or ~1.5 years ago, I made #2, the Russian language replacement aka mctaylors-ru. This was my first contribution to the Octobot project (formerly known as Boyfriend). This was to add some sort of unique, unusual feature to Octobot, which doesn't have any moderator bots. Everyone loved the language. But it just became difficult to maintain. I certainly don't want to get rid of it, but it leaves me no other choice. This isn't a joke or anything like that. I'm tired of maintaining it. And I'm sure the other contributors are too. This PR removes the mctaylors-ru language. --------- Signed-off-by: mctaylors <cantsendmails@mctaylors.ru> Co-authored-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
96680d3beb
commit
d3053d87e8
3 changed files with 17 additions and 688 deletions
|
@ -11,8 +11,7 @@ public sealed class LanguageOption : Option<CultureInfo>
|
|||
private static readonly Dictionary<string, CultureInfo> CultureInfoCache = new()
|
||||
{
|
||||
{ "en", new CultureInfo("en-US") },
|
||||
{ "ru", new CultureInfo("ru-RU") },
|
||||
{ "mctaylors-ru", new CultureInfo("tt-RU") }
|
||||
{ "ru", new CultureInfo("ru-RU") }
|
||||
};
|
||||
|
||||
public LanguageOption(string name, string defaultValue) : base(name, CultureInfoCache[defaultValue]) { }
|
||||
|
|
|
@ -78,7 +78,7 @@ public sealed class GuildDataService : BackgroundService
|
|||
var settingsPath = $"{path}/Settings.json";
|
||||
var scheduledEventsPath = $"{path}/ScheduledEvents.json";
|
||||
|
||||
MigrateGuildData(guildId, path);
|
||||
MigrateDataDirectory(guildId, path);
|
||||
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
|
@ -106,6 +106,11 @@ public sealed class GuildDataService : BackgroundService
|
|||
dataLoadFailed = true;
|
||||
}
|
||||
|
||||
if (jsonSettings is not null)
|
||||
{
|
||||
FixJsonSettings(jsonSettings);
|
||||
}
|
||||
|
||||
await using var eventsStream = File.OpenRead(scheduledEventsPath);
|
||||
Dictionary<ulong, ScheduledEventData>? events = null;
|
||||
try
|
||||
|
@ -155,7 +160,7 @@ public sealed class GuildDataService : BackgroundService
|
|||
return finalData;
|
||||
}
|
||||
|
||||
private void MigrateGuildData(Snowflake guildId, string newPath)
|
||||
private void MigrateDataDirectory(Snowflake guildId, string newPath)
|
||||
{
|
||||
var oldPath = $"{guildId}";
|
||||
|
||||
|
@ -169,6 +174,15 @@ public sealed class GuildDataService : BackgroundService
|
|||
}
|
||||
}
|
||||
|
||||
private static void FixJsonSettings(JsonNode settings)
|
||||
{
|
||||
var language = settings[GuildSettings.Language.Name]?.GetValue<string>();
|
||||
if (language is "mctaylors-ru")
|
||||
{
|
||||
settings[GuildSettings.Language.Name] = "ru";
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<JsonNode> GetSettings(Snowflake guildId, CancellationToken ct = default)
|
||||
{
|
||||
return (await GetData(guildId, ct)).Settings;
|
||||
|
|
Reference in a new issue