Skip to content

Commit

Permalink
/activity choose: Error on invalid ID
Browse files Browse the repository at this point in the history
  • Loading branch information
FloatingMilkshake committed Oct 21, 2024
1 parent ce25748 commit db7182e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Commands/Owner/HomeServerCommands/ActivityCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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)
Expand Down

0 comments on commit db7182e

Please sign in to comment.