diff --git a/src/Commands/BanCommandGroup.cs b/src/Commands/BanCommandGroup.cs index bfc60c5..3f89819 100644 --- a/src/Commands/BanCommandGroup.cs +++ b/src/Commands/BanCommandGroup.cs @@ -135,10 +135,10 @@ public class BanCommandGroup : CommandGroup return await _feedback.SendContextualEmbedResultAsync(errorEmbed, ct); } - var builder = new StringBuilder().AppendLineWithBullet(string.Format(Messages.DescriptionActionReason, reason)); + var builder = new StringBuilder().AppendBulletPointLine(string.Format(Messages.DescriptionActionReason, reason)); if (duration is not null) { - builder.AppendWithBullet( + builder.AppendBulletPoint( string.Format( Messages.DescriptionActionExpiresAt, Markdown.Timestamp(DateTimeOffset.UtcNow.Add(duration.Value)))); @@ -273,7 +273,7 @@ public class BanCommandGroup : CommandGroup .WithColour(ColorsList.Green).Build(); var title = string.Format(Messages.UserUnbanned, target.GetTag()); - var description = new StringBuilder().AppendWithBullet(string.Format(Messages.DescriptionActionReason, reason)); + var description = new StringBuilder().AppendBulletPoint(string.Format(Messages.DescriptionActionReason, reason)); var logResult = _utility.LogActionAsync( data.Settings, channelId, executor, title, description.ToString(), target, ColorsList.Green, ct: ct); if (!logResult.IsSuccess) diff --git a/src/Commands/MuteCommandGroup.cs b/src/Commands/MuteCommandGroup.cs index 4915043..21d2a8f 100644 --- a/src/Commands/MuteCommandGroup.cs +++ b/src/Commands/MuteCommandGroup.cs @@ -136,8 +136,8 @@ public class MuteCommandGroup : CommandGroup } var title = string.Format(Messages.UserMuted, target.GetTag()); - var description = new StringBuilder().AppendLineWithBullet(string.Format(Messages.DescriptionActionReason, reason)) - .AppendWithBullet(string.Format( + var description = new StringBuilder().AppendBulletPointLine(string.Format(Messages.DescriptionActionReason, reason)) + .AppendBulletPoint(string.Format( Messages.DescriptionActionExpiresAt, Markdown.Timestamp(until))).ToString(); var logResult = _utility.LogActionAsync( diff --git a/src/Commands/RemindCommandGroup.cs b/src/Commands/RemindCommandGroup.cs index dbc31e5..7c087e1 100644 --- a/src/Commands/RemindCommandGroup.cs +++ b/src/Commands/RemindCommandGroup.cs @@ -90,9 +90,9 @@ public class RemindCommandGroup : CommandGroup for (var i = 0; i < data.Reminders.Count; i++) { var reminder = data.Reminders[i]; - builder.AppendLineWithBullet(string.Format(Messages.ReminderPosition, Markdown.InlineCode((i + 1).ToString()))) - .AppendLineWithSubBullet(string.Format(Messages.ReminderText, Markdown.InlineCode(reminder.Text))) - .AppendLineWithSubBullet(string.Format(Messages.ReminderTime, Markdown.Timestamp(reminder.At))); + builder.AppendBulletPointLine(string.Format(Messages.ReminderPosition, Markdown.InlineCode((i + 1).ToString()))) + .AppendSubBulletPointLine(string.Format(Messages.ReminderText, Markdown.InlineCode(reminder.Text))) + .AppendSubBulletPointLine(string.Format(Messages.ReminderTime, Markdown.Timestamp(reminder.At))); } var embed = new EmbedBuilder().WithSmallTitle( @@ -154,9 +154,9 @@ public class RemindCommandGroup : CommandGroup Text = text }); - var builder = new StringBuilder().AppendLineWithBullet(string.Format( + var builder = new StringBuilder().AppendBulletPointLine(string.Format( Messages.ReminderText, Markdown.InlineCode(text))) - .AppendWithBullet(string.Format(Messages.ReminderTime, Markdown.Timestamp(remindAt))); + .AppendBulletPoint(string.Format(Messages.ReminderTime, Markdown.Timestamp(remindAt))); var embed = new EmbedBuilder().WithSmallTitle( string.Format(Messages.ReminderCreated, executor.GetTag()), executor) @@ -214,8 +214,8 @@ public class RemindCommandGroup : CommandGroup var reminder = data.Reminders[index]; var description = new StringBuilder() - .AppendLineWithBullet(string.Format(Messages.ReminderText, Markdown.InlineCode(reminder.Text))) - .AppendLineWithBullet(string.Format(Messages.ReminderTime, Markdown.Timestamp(reminder.At))); + .AppendBulletPointLine(string.Format(Messages.ReminderText, Markdown.InlineCode(reminder.Text))) + .AppendBulletPointLine(string.Format(Messages.ReminderTime, Markdown.Timestamp(reminder.At))); data.Reminders.RemoveAt(index); diff --git a/src/Commands/ToolsCommandGroup.cs b/src/Commands/ToolsCommandGroup.cs index 59f2b3c..0cb237a 100644 --- a/src/Commands/ToolsCommandGroup.cs +++ b/src/Commands/ToolsCommandGroup.cs @@ -102,11 +102,11 @@ public class ToolsCommandGroup : CommandGroup if (target.GlobalName is not null) { - builder.AppendLineWithBullet(Messages.UserInfoDisplayName) + builder.AppendBulletPointLine(Messages.UserInfoDisplayName) .AppendLine(Markdown.InlineCode(target.GlobalName)); } - builder.AppendLineWithBullet(Messages.UserInfoDiscordUserSince) + builder.AppendBulletPointLine(Messages.UserInfoDiscordUserSince) .AppendLine(Markdown.Timestamp(target.ID.Timestamp)); var memberData = data.GetOrCreateMemberData(target.ID); @@ -170,23 +170,23 @@ public class ToolsCommandGroup : CommandGroup { if (guildMember.Nickname.IsDefined(out var nickname)) { - builder.AppendLineWithBullet(Messages.UserInfoGuildNickname) + builder.AppendBulletPointLine(Messages.UserInfoGuildNickname) .AppendLine(Markdown.InlineCode(nickname)); } - builder.AppendLineWithBullet(Messages.UserInfoGuildMemberSince) + builder.AppendBulletPointLine(Messages.UserInfoGuildMemberSince) .AppendLine(Markdown.Timestamp(guildMember.JoinedAt)); if (guildMember.PremiumSince.IsDefined(out var premiumSince)) { - builder.AppendLineWithBullet(Messages.UserInfoGuildMemberPremiumSince) + builder.AppendBulletPointLine(Messages.UserInfoGuildMemberPremiumSince) .AppendLine(Markdown.Timestamp(premiumSince.Value)); color = ColorsList.Magenta; } if (guildMember.Roles.Count > 0) { - builder.AppendLineWithBullet(Messages.UserInfoGuildRoles); + builder.AppendBulletPointLine(Messages.UserInfoGuildRoles); for (var i = 0; i < guildMember.Roles.Count - 1; i++) { builder.Append($"<@&{guildMember.Roles[i]}>, "); @@ -202,30 +202,30 @@ public class ToolsCommandGroup : CommandGroup { if (memberData.BannedUntil < DateTimeOffset.MaxValue) { - builder.AppendLineWithBullet(Messages.UserInfoBanned) - .AppendLineWithSubBullet(string.Format( + builder.AppendBulletPointLine(Messages.UserInfoBanned) + .AppendSubBulletPointLine(string.Format( Messages.DescriptionActionExpiresAt, Markdown.Timestamp(memberData.BannedUntil.Value))); return; } - builder.AppendLineWithBullet(Messages.UserInfoBannedPermanently); + builder.AppendBulletPointLine(Messages.UserInfoBannedPermanently); } private static void AppendMuteInformation( MemberData memberData, DateTimeOffset? communicationDisabledUntil, StringBuilder builder) { - builder.AppendLineWithBullet(Messages.UserInfoMuted); + builder.AppendBulletPointLine(Messages.UserInfoMuted); if (memberData.MutedUntil is not null && DateTimeOffset.UtcNow <= memberData.MutedUntil) { - builder.AppendLineWithSubBullet(Messages.UserInfoMutedByMuteRole) - .AppendLineWithSubBullet(string.Format( + builder.AppendSubBulletPointLine(Messages.UserInfoMutedByMuteRole) + .AppendSubBulletPointLine(string.Format( Messages.DescriptionActionExpiresAt, Markdown.Timestamp(memberData.MutedUntil.Value))); } if (communicationDisabledUntil is not null) { - builder.AppendLineWithSubBullet(Messages.UserInfoMutedByTimeout) - .AppendLineWithSubBullet(string.Format( + builder.AppendSubBulletPointLine(Messages.UserInfoMutedByTimeout) + .AppendSubBulletPointLine(string.Format( Messages.DescriptionActionExpiresAt, Markdown.Timestamp(communicationDisabledUntil.Value))); } } @@ -282,13 +282,13 @@ public class ToolsCommandGroup : CommandGroup if (guild.Description is not null) { - description.AppendLineWithBullet(Messages.GuildInfoDescription) + description.AppendBulletPointLine(Messages.GuildInfoDescription) .AppendLine(Markdown.InlineCode(guild.Description)); } - description.AppendLineWithBullet(Messages.GuildInfoCreatedAt) + description.AppendBulletPointLine(Messages.GuildInfoCreatedAt) .AppendLine(Markdown.Timestamp(guild.ID.Timestamp)) - .AppendLineWithBullet(Messages.GuildInfoOwner) + .AppendBulletPointLine(Messages.GuildInfoOwner) .AppendLine(Mention.User(guild.OwnerID)); var embedColor = ColorsList.Cyan; @@ -296,9 +296,9 @@ public class ToolsCommandGroup : CommandGroup if (guild.PremiumTier > PremiumTier.None) { description.Append("### ").AppendLine(Messages.GuildInfoServerBoost) - .AppendWithBullet(Messages.GuildInfoBoostTier) + .AppendBulletPoint(Messages.GuildInfoBoostTier) .Append(": ").AppendLine(Markdown.InlineCode(guild.PremiumTier.ToString())) - .AppendWithBullet(Messages.GuildInfoBoostCount) + .AppendBulletPoint(Messages.GuildInfoBoostCount) .Append(": ").AppendLine(Markdown.InlineCode(guild.PremiumSubscriptionCount.ToString())); embedColor = ColorsList.Magenta; } @@ -362,14 +362,14 @@ public class ToolsCommandGroup : CommandGroup var description = new StringBuilder().Append("# ").Append(i); - description.AppendLine().AppendWithBullet(string.Format( + description.AppendLine().AppendBulletPoint(string.Format( Messages.RandomMin, Markdown.InlineCode(min.ToString()))); if (secondNullable is null && first >= secondDefault) { description.Append(' ').Append(Messages.Default); } - description.AppendLine().AppendWithBullet(string.Format( + description.AppendLine().AppendBulletPoint(string.Format( Messages.RandomMax, Markdown.InlineCode(max.ToString()))); if (secondNullable is null && first < secondDefault) { @@ -449,7 +449,7 @@ public class ToolsCommandGroup : CommandGroup foreach (var markdownTimestamp in AllStyles.Select(style => Markdown.Timestamp(timestamp, style))) { - description.AppendWithBullet(Markdown.InlineCode(markdownTimestamp)) + description.AppendBulletPoint(Markdown.InlineCode(markdownTimestamp)) .Append(" → ").AppendLine(markdownTimestamp); } diff --git a/src/Extensions/StringBuilderExtensions.cs b/src/Extensions/StringBuilderExtensions.cs index 00b7db8..a3c38d0 100644 --- a/src/Extensions/StringBuilderExtensions.cs +++ b/src/Extensions/StringBuilderExtensions.cs @@ -4,17 +4,17 @@ namespace Octobot.Extensions; public static class StringBuilderExtensions { - public static StringBuilder AppendWithBullet(this StringBuilder builder, string? text) + public static StringBuilder AppendBulletPoint(this StringBuilder builder, string? text) { return builder.Append("- ").Append(text); } - public static StringBuilder AppendLineWithBullet(this StringBuilder builder, string? text) + public static StringBuilder AppendBulletPointLine(this StringBuilder builder, string? text) { return builder.Append("- ").AppendLine(text); } - public static StringBuilder AppendLineWithSubBullet(this StringBuilder builder, string? text) + public static StringBuilder AppendSubBulletPointLine(this StringBuilder builder, string? text) { return builder.Append(" - ").AppendLine(text); }