diff --git a/ProjectPlugins/CodexPlugin/MarketplaceAccess.cs b/ProjectPlugins/CodexPlugin/MarketplaceAccess.cs index 11f3b60..dded835 100644 --- a/ProjectPlugins/CodexPlugin/MarketplaceAccess.cs +++ b/ProjectPlugins/CodexPlugin/MarketplaceAccess.cs @@ -27,6 +27,7 @@ namespace CodexPlugin var response = codexAccess.RequestStorage(purchase); if (string.IsNullOrEmpty(response) || + response == "Unable to encode manifest" || response == "Purchasing not available" || response == "Expiry required" || response == "Expiry needs to be in future" || diff --git a/Tools/BiblioTech/CommandHandler.cs b/Tools/BiblioTech/CommandHandler.cs index 93b0ac5..c2d4f14 100644 --- a/Tools/BiblioTech/CommandHandler.cs +++ b/Tools/BiblioTech/CommandHandler.cs @@ -35,12 +35,6 @@ namespace BiblioTech Program.AdminChecker.SetAdminChannel(adminChannels.First()); Program.RoleDriver = new RoleDriver(client, log, replacement); - if (Program.Config.DeleteCommandsAtStartup > 0) - { - log.Log("Deleting all application commands..."); - await guild.DeleteApplicationCommandsAsync(); - } - var builders = commands.Select(c => { var msg = $"Building command '{c.Name}' with options: "; @@ -60,10 +54,16 @@ namespace BiblioTech try { - log.Log("Creating application commands..."); - foreach (var builder in builders) + log.Log("Building application commands..."); + var commands = builders.Select(b => b.Build()).ToArray(); + + log.Log("Submitting application commands..."); + var response = await guild.BulkOverwriteApplicationCommandAsync(commands); + + log.Log("Commands in response:"); + foreach (var cmd in response) { - await guild.CreateApplicationCommandAsync(builder.Build()); + log.Log($"{cmd.Name} ({cmd.Description}) [{DescribOptions(cmd.Options)}]"); } } catch (HttpException exception) @@ -71,6 +71,17 @@ namespace BiblioTech var json = JsonConvert.SerializeObject(exception.Errors, Formatting.Indented); log.Error(json); } + log.Log("Initialized."); + } + + private string DescribOptions(IReadOnlyCollection options) + { + return string.Join(",", options.Select(DescribeOption).ToArray()); + } + + private string DescribeOption(SocketApplicationCommandOption option) + { + return $"({option.Name}[{DescribOptions(option.Options)}])"; } private async Task SlashCommandHandler(SocketSlashCommand command) diff --git a/Tools/BiblioTech/Configuration.cs b/Tools/BiblioTech/Configuration.cs index b896eb1..6f27fd1 100644 --- a/Tools/BiblioTech/Configuration.cs +++ b/Tools/BiblioTech/Configuration.cs @@ -38,9 +38,6 @@ namespace BiblioTech [Uniform("no-discord", "nd", "NODISCORD", false, "For debugging: Bypasses all Discord API calls.")] public int NoDiscord { get; set; } = 0; - [Uniform("delete-commands-at-startup", "dcas", "DELETECMDSATSTARTUP", false, "If > 0, deletes all app commands at startup.")] - public int DeleteCommandsAtStartup { get; set; } = 0; - public string EndpointsPath => Path.Combine(DataPath, "endpoints"); public string UserDataPath => Path.Combine(DataPath, "users"); public string LogPath => Path.Combine(DataPath, "logs");