From db7182eecafab9d5d95bf47b9866ea2dc59327be Mon Sep 17 00:00:00 2001 From: FloatingMilkshake Date: Mon, 21 Oct 2024 07:58:35 -0400 Subject: [PATCH] /activity choose: Error on invalid ID --- Commands/Owner/HomeServerCommands/ActivityCommands.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Commands/Owner/HomeServerCommands/ActivityCommands.cs b/Commands/Owner/HomeServerCommands/ActivityCommands.cs index 369fa57..0960a4a 100644 --- a/Commands/Owner/HomeServerCommands/ActivityCommands.cs +++ b/Commands/Owner/HomeServerCommands/ActivityCommands.cs @@ -66,6 +66,12 @@ public static async Task ChooseActvity(SlashCommandContext ctx, return; } + if (id > dbList.Length || id < 1) + { + await ctx.FollowupAsync(new DiscordFollowupMessageBuilder().WithContent("There's no activity with that ID!")); + return; + } + var index = 1; foreach (var item in dbList) { @@ -74,7 +80,7 @@ public static async Task ChooseActvity(SlashCommandContext ctx, index++; continue; } - + // Try to format stored activity as a DiscordActivity; on failure, show error & return var (success, activity) = ParseActivityType(new DiscordActivity { Name = item.Name }, item); if (!success)