-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
15fb03e
commit 6b4ec2b
Showing
9 changed files
with
111 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using DSharpPlus.Entities; | ||
using DSharpPlus.SlashCommands; | ||
using SuggestionBot.AutocompleteProviders; | ||
using SuggestionBot.Data; | ||
using X10D.DSharpPlus; | ||
|
||
namespace SuggestionBot.Commands; | ||
|
||
internal sealed partial class SuggestionCommand | ||
{ | ||
[SlashCommand("remove", "Remove a suggestion.", false)] | ||
public async Task RemoveAsync(InteractionContext context, | ||
[Option("suggestion", "The suggestion whose status to change.")] | ||
[Autocomplete(typeof(SuggestionAutocompleteProvider))] | ||
string query, | ||
[Option("remarks", "Additional remarks about the suggestion.")] | ||
string? remarks = null) | ||
{ | ||
var response = new DiscordInteractionResponseBuilder(); | ||
|
||
if (!TryGetSuggestion(context.Guild, query, out Suggestion? suggestion)) | ||
{ | ||
response.AsEphemeral(); | ||
response.AddEmbed(CreateNotFoundEmbed(query)); | ||
await context.CreateResponseAsync(ResponseType, response).ConfigureAwait(false); | ||
return; | ||
} | ||
|
||
var embed = new DiscordEmbedBuilder(); | ||
if (_suggestionService.SetStatus(suggestion, SuggestionStatus.Removed, context.Member, remarks)) | ||
{ | ||
embed.WithColor(DiscordColor.Red); | ||
embed.WithTitle("Suggestion Removed"); | ||
embed.WithDescription($"The suggestion with the ID {suggestion.Id} has been REMOVED."); | ||
if (!string.IsNullOrWhiteSpace(remarks)) | ||
{ | ||
embed.AddField("Staff Remarks", remarks); | ||
} | ||
|
||
await _mailmanService.SendSuggestionAsync(suggestion).ConfigureAwait(false); | ||
} | ||
|
||
response.AddEmbed(embed); | ||
await context.CreateResponseAsync(ResponseType, response).ConfigureAwait(false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,6 @@ public enum SuggestionStatus | |
Suggested, | ||
Rejected, | ||
Implemented, | ||
Accepted | ||
Accepted, | ||
Removed | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters