Skip to content

Commit

Permalink
perf: AsEphemeral once, early
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbooth committed Jul 21, 2023
1 parent 334f85b commit 2628f29
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions SuggestionBot/Commands/SuggestCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ public async Task SuggestAsync(InteractionContext context)
if (response != DiscordModalResponse.Success) return;

var followUp = new DiscordFollowupMessageBuilder();
followUp.AsEphemeral();

if (string.IsNullOrWhiteSpace(input.Value))
{
followUp.WithContent("No content provided. Suggestion cancelled.");
followUp.AsEphemeral();
await context.FollowUpAsync(followUp).ConfigureAwait(false);
return;
}
Expand All @@ -79,13 +80,11 @@ public async Task SuggestAsync(InteractionContext context)
if (message == null)
{
followUp.WithContent("Failed to post suggestion. If this issue persists, please contact ModMail.");
followUp.AsEphemeral();
await context.FollowUpAsync(followUp).ConfigureAwait(false);
return;
}

followUp.WithContent($"Your suggestion has been created and can be viewed here: {message.JumpLink}");
followUp.AsEphemeral();
await context.FollowUpAsync(followUp).ConfigureAwait(false);
}
}

0 comments on commit 2628f29

Please sign in to comment.