Skip to content

Commit

Permalink
feat: add additional states
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverbooth committed Jul 24, 2023
1 parent 2e39c2c commit 1896c39
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 2 deletions.
12 changes: 12 additions & 0 deletions SuggestionBot/Configuration/GuildConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public sealed class GuildConfiguration
/// <value><see langword="true" /> if a thread should be created; otherwise, <see langword="false" />.</value>
public bool CreateThreadForSuggestion { get; set; } = true;

/// <summary>
/// Gets or sets the embed color for implemented suggestions.
/// </summary>
/// <value>The embed color for implemented suggestions.</value>
public int DuplicateColor { get; set; } = 0xA0A0A0;

/// <summary>
/// Gets or sets the embed color for implemented suggestions.
/// </summary>
Expand All @@ -41,6 +47,12 @@ public sealed class GuildConfiguration
/// <value>The log channel ID.</value>
public ulong LogChannel { get; set; }

/// <summary>
/// Gets or sets the embed color for rejected suggestions.
/// </summary>
/// <value>The embed color for rejected suggestions.</value>
public int PlannedColor { get; set; } = 0x6495ED;

/// <summary>
/// Gets or sets the embed color for rejected suggestions.
/// </summary>
Expand Down
5 changes: 4 additions & 1 deletion SuggestionBot/Data/SuggestionStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,8 @@ public enum SuggestionStatus
Rejected,
Implemented,
Accepted,
Removed
Removed,
Duplicate,
AlreadyImplemented,
AlreadyPlanned
}
33 changes: 33 additions & 0 deletions SuggestionBot/Resources/PrivateMessages.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions SuggestionBot/Resources/PrivateMessages.resx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@
</value>
</resheader>

<data name="PlannedDescription" xml:space="preserve">
<value>{user.Mention}, your suggestion in **{guild.Name}** has been closed by staff because the changes you suggested have already been planned for the server.

If you have any further questions, please reach us by sending a DM to ModMail.</value>
</data>

<data name="AlreadyImplementedDescription" xml:space="preserve">
<value>{user.Mention}, your suggestion in **{guild.Name}** has been closed by staff because the changes you suggested are already present in the server.

If you have any further questions, please reach us by sending a DM to ModMail.</value>
</data>

<data name="DuplicateDescription" xml:space="preserve">
<value>{user.Mention}, your suggestion in **{guild.Name}** has been closed by staff because it was determined to be a duplicate of an existing suggestion which supersedes it or was previously closed.

If you have any further questions, please reach us by sending a DM to ModMail.</value>
</data>

<data name="RemovedDescription" xml:space="preserve">
<value>{user.Mention}, your suggestion in **{guild.Name}** has been removed by staff because it was inappropriate or violated our server rules.
Repeated abuse will result in you losing access to the channel.
Expand Down
18 changes: 18 additions & 0 deletions SuggestionBot/Services/MailmanService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,24 @@ private bool TryBuildEmbed(Suggestion suggestion, DiscordEmbedBuilder embed, Dis
embed.WithDescription(PrivateMessages.ImplementedDescription.FormatSmart(new { user = author, guild }));
break;

case SuggestionStatus.Duplicate:
embed.WithColor(configuration.DuplicateColor);
embed.WithTitle("Suggestion Closed (Duplicate)");
embed.WithDescription(PrivateMessages.DuplicateDescription.FormatSmart(new { user = author, guild }));
break;

case SuggestionStatus.AlreadyImplemented:
embed.WithColor(configuration.ImplementedColor);
embed.WithTitle("Suggestion Closed (Already Implemented)");
embed.WithDescription(PrivateMessages.DuplicateDescription.FormatSmart(new { user = author, guild }));
break;

case SuggestionStatus.AlreadyPlanned:
embed.WithColor(configuration.PlannedColor);
embed.WithTitle("Suggestion Closed (Already Planned)");
embed.WithDescription(PrivateMessages.PlannedDescription.FormatSmart(new { user = author, guild }));
break;

default:
return false;
}
Expand Down
7 changes: 6 additions & 1 deletion SuggestionBot/Services/SuggestionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,9 @@ private DiscordEmbedBuilder CreateDefaultEmbed(Suggestion suggestion, DiscordGui
SuggestionStatus.Rejected => "❌",
SuggestionStatus.Implemented => "✅",
SuggestionStatus.Accepted => "✅",
SuggestionStatus.Duplicate => "🔁",
SuggestionStatus.AlreadyImplemented => "✅",
SuggestionStatus.AlreadyPlanned => "📅",
_ => throw new ArgumentOutOfRangeException(nameof(suggestion), suggestion.Status, null)
};

Expand All @@ -662,8 +665,10 @@ private DiscordEmbedBuilder CreateDefaultEmbed(Suggestion suggestion, DiscordGui
{
SuggestionStatus.Suggested => configuration.SuggestedColor,
SuggestionStatus.Rejected => configuration.RejectedColor,
SuggestionStatus.Implemented => configuration.ImplementedColor,
SuggestionStatus.Implemented or SuggestionStatus.AlreadyImplemented => configuration.ImplementedColor,
SuggestionStatus.Accepted => configuration.AcceptedColor,
SuggestionStatus.Duplicate => configuration.DuplicateColor,
SuggestionStatus.AlreadyPlanned => configuration.PlannedColor,
_ => throw new ArgumentOutOfRangeException(nameof(suggestion), suggestion.Status, null)
});

Expand Down

0 comments on commit 1896c39

Please sign in to comment.