diff --git a/src/Commands/KickCommandGroup.cs b/src/Commands/KickCommandGroup.cs
index 21ed22b..1567f89 100644
--- a/src/Commands/KickCommandGroup.cs
+++ b/src/Commands/KickCommandGroup.cs
@@ -13,6 +13,7 @@ using Remora.Discord.Commands.Conditions;
using Remora.Discord.Commands.Contexts;
using Remora.Discord.Commands.Feedback.Services;
using Remora.Discord.Extensions.Embeds;
+using Remora.Discord.Extensions.Formatting;
using Remora.Rest.Core;
using Remora.Results;
@@ -134,7 +135,7 @@ public class KickCommandGroup : CommandGroup
{
var dmEmbed = new EmbedBuilder().WithGuildTitle(guild)
.WithTitle(Messages.YouWereKicked)
- .WithDescription(string.Format(Messages.DescriptionActionReason, reason).AddBulletPoint())
+ .WithDescription(MarkdownExtensions.BulletPoint(string.Format(Messages.DescriptionActionReason, reason)))
.WithActionFooter(executor)
.WithCurrentTimestamp()
.WithColour(ColorsList.Red)
@@ -159,7 +160,7 @@ public class KickCommandGroup : CommandGroup
data.GetOrCreateMemberData(target.ID).Roles.Clear();
var title = string.Format(Messages.UserKicked, target.GetTag());
- var description = string.Format(Messages.DescriptionActionReason, reason).AddBulletPoint();
+ var description = MarkdownExtensions.BulletPoint(string.Format(Messages.DescriptionActionReason, reason));
var logResult = _utility.LogActionAsync(
data.Settings, channelId, executor, title, description, target, ColorsList.Red, ct: ct);
if (!logResult.IsSuccess)
diff --git a/src/Commands/MuteCommandGroup.cs b/src/Commands/MuteCommandGroup.cs
index 211e610..2ce06ae 100644
--- a/src/Commands/MuteCommandGroup.cs
+++ b/src/Commands/MuteCommandGroup.cs
@@ -325,7 +325,7 @@ public class MuteCommandGroup : CommandGroup
}
var title = string.Format(Messages.UserUnmuted, target.GetTag());
- var description = string.Format(Messages.DescriptionActionReason, reason).AddBulletPoint();
+ var description = MarkdownExtensions.BulletPoint(string.Format(Messages.DescriptionActionReason, reason));
var logResult = _utility.LogActionAsync(
data.Settings, channelId, executor, title, description, target, ColorsList.Green, ct: ct);
if (!logResult.IsSuccess)
diff --git a/src/Extensions/MarkdownExtensions.cs b/src/Extensions/MarkdownExtensions.cs
new file mode 100644
index 0000000..7b7f780
--- /dev/null
+++ b/src/Extensions/MarkdownExtensions.cs
@@ -0,0 +1,16 @@
+namespace Octobot.Extensions;
+
+public static class MarkdownExtensions
+{
+ ///
+ /// Formats a string to use Markdown Bullet formatting.
+ ///
+ /// The input text to format.
+ ///
+ /// A markdown-formatted bullet string.
+ ///
+ public static string BulletPoint(string text)
+ {
+ return $"- {text}";
+ }
+}
diff --git a/src/Extensions/StringBuilderExtensions.cs b/src/Extensions/StringBuilderExtensions.cs
index 8fdef60..ddd24a3 100644
--- a/src/Extensions/StringBuilderExtensions.cs
+++ b/src/Extensions/StringBuilderExtensions.cs
@@ -4,23 +4,59 @@ namespace Octobot.Extensions;
public static class StringBuilderExtensions
{
- public static StringBuilder AppendBulletPoint(this StringBuilder builder, string? text)
+ ///
+ /// Appends the input string with Markdown Bullet formatting to the specified object.
+ ///
+ /// The object.
+ /// The string to append with bullet point.
+ ///
+ /// The builder with the appended string with Markdown Bullet formatting.
+ ///
+ public static StringBuilder AppendBulletPoint(this StringBuilder builder, string? value)
{
- return builder.Append("- ").Append(text);
+ return builder.Append("- ").Append(value);
}
- public static StringBuilder AppendSubBulletPoint(this StringBuilder builder, string? text)
+ ///
+ /// Appends the input string with Markdown Sub-Bullet formatting to the specified object.
+ ///
+ /// The object.
+ /// The string to append with sub-bullet point.
+ ///
+ /// The builder with the appended string with Markdown Sub-Bullet formatting.
+ ///
+ public static StringBuilder AppendSubBulletPoint(this StringBuilder builder, string? value)
{
- return builder.Append(" - ").Append(text);
+ return builder.Append(" - ").Append(value);
}
- public static StringBuilder AppendBulletPointLine(this StringBuilder builder, string? text)
+ ///
+ /// Appends the input string with Markdown Bullet formatting followed by
+ /// the default line terminator to the end of specified object.
+ ///
+ /// The object.
+ /// The string to append with bullet point.
+ ///
+ /// The builder with the appended string with Markdown Bullet formatting
+ /// and default line terminator at the end.
+ ///
+ public static StringBuilder AppendBulletPointLine(this StringBuilder builder, string? value)
{
- return builder.Append("- ").AppendLine(text);
+ return builder.Append("- ").AppendLine(value);
}
- public static StringBuilder AppendSubBulletPointLine(this StringBuilder builder, string? text)
+ ///
+ /// Appends the input string with Markdown Sub-Bullet formatting followed by
+ /// the default line terminator to the end of specified object.
+ ///
+ /// The object.
+ /// The string to append with sub-bullet point.
+ ///
+ /// The builder with the appended string with Markdown Sub-Bullet formatting
+ /// and default line terminator at the end.
+ ///
+ public static StringBuilder AppendSubBulletPointLine(this StringBuilder builder, string? value)
{
- return builder.Append(" - ").AppendLine(text);
+ return builder.Append(" - ").AppendLine(value);
}
}
diff --git a/src/Extensions/StringExtensions.cs b/src/Extensions/StringExtensions.cs
index 8cc33d9..13cd88a 100644
--- a/src/Extensions/StringExtensions.cs
+++ b/src/Extensions/StringExtensions.cs
@@ -63,9 +63,4 @@ public static class StringExtensions
{
return WebUtility.UrlEncode(s).Replace('+', ' ');
}
-
- public static string AddBulletPoint(this string s)
- {
- return $"- {s}";
- }
}