diff --git a/DisCatSharp.ApplicationCommands/ApplicationCommandsExtension.cs b/DisCatSharp.ApplicationCommands/ApplicationCommandsExtension.cs index 64f1b75af..72d86d168 100644 --- a/DisCatSharp.ApplicationCommands/ApplicationCommandsExtension.cs +++ b/DisCatSharp.ApplicationCommands/ApplicationCommandsExtension.cs @@ -803,7 +803,7 @@ private async Task RegisterCommands(List { updateList = updateList.DistinctBy(x => x.Name).ToList(); if (Configuration.GenerateTranslationFilesOnly) - await this.CheckRegistrationStartup(translation, groupTranslation); + await this.CheckRegistrationStartup(translation, groupTranslation, guildId); else try { @@ -964,7 +964,8 @@ private async Task RegisterCommands(List /// /// The optional translations. /// The optional group translations. - private async Task CheckRegistrationStartup(List? translation = null, List? groupTranslation = null) + /// The optional guild id. + private async Task CheckRegistrationStartup(List? translation = null, List? groupTranslation = null, ulong? guildId = null) { if (Configuration.GenerateTranslationFilesOnly) { @@ -972,7 +973,7 @@ private async Task CheckRegistrationStartup(List? translation { if (translation is not null && translation.Count is not 0) { - var fileName = $"translation_generator_export-shard{this.Client.ShardId}-SINGLE.json"; + var fileName = $"translation_generator_export-shard{this.Client.ShardId}-SINGLE-{(guildId.HasValue ? guildId.Value : "global")}.json"; var fs = File.Create(fileName); var ms = new MemoryStream(); var writer = new StreamWriter(ms); @@ -990,7 +991,7 @@ private async Task CheckRegistrationStartup(List? translation if (groupTranslation is not null && groupTranslation.Count is not 0) { - var fileName = $"translation_generator_export-shard{this.Client.ShardId}-GROUP.json"; + var fileName = $"translation_generator_export-shard{this.Client.ShardId}-GROUP-{(guildId.HasValue ? guildId.Value : "global")}.json"; var fs = File.Create(fileName); var ms = new MemoryStream(); var writer = new StreamWriter(ms); @@ -1029,6 +1030,8 @@ private async Task CheckStartupFinishAsync(ApplicationCommandsExtension sender, GuildsWithoutScope = s_missingScopeGuildIdsGlobal }).ConfigureAwait(false); FinishFired = true; + if (Configuration.GenerateTranslationFilesOnly) + Environment.Exit(0); } args.Handled = false;