1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-19 16:33:36 +03:00

Add .AddBulletPoint()

This commit is contained in:
Macintxsh 2023-12-04 15:43:23 +03:00
parent c52fe1ce09
commit 76d1089c38
Signed by: mctaylors
GPG key ID: 7181BEBE676903C1
6 changed files with 17 additions and 7 deletions

View file

@ -88,7 +88,7 @@ public class AboutCommandGroup : CommandGroup
guildId, dev.Id, ct);
var tag = guildMemberResult.IsSuccess ? $"<@{dev.Id}>" : $"@{dev.Username}";
builder.AppendLine($"- {tag} — {$"AboutDeveloper@{dev.Username}".Localized()}");
builder.AppendBulletPointLine($"{tag} — {$"AboutDeveloper@{dev.Username}".Localized()}");
}
builder.Append($"### [{Messages.AboutTitleRepository}](https://github.com/LabsDevelopment/Octobot)");

View file

@ -134,7 +134,7 @@ public class KickCommandGroup : CommandGroup
{
var dmEmbed = new EmbedBuilder().WithGuildTitle(guild)
.WithTitle(Messages.YouWereKicked)
.WithDescription($"- {string.Format(Messages.DescriptionActionReason, reason)}")
.WithDescription(string.Format(Messages.DescriptionActionReason, reason).AddBulletPoint())
.WithActionFooter(executor)
.WithCurrentTimestamp()
.WithColour(ColorsList.Red)
@ -159,7 +159,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)}";
var description = string.Format(Messages.DescriptionActionReason, reason).AddBulletPoint();
var logResult = _utility.LogActionAsync(
data.Settings, channelId, executor, title, description, target, ColorsList.Red, ct: ct);
if (!logResult.IsSuccess)

View file

@ -325,7 +325,7 @@ public class MuteCommandGroup : CommandGroup
}
var title = string.Format(Messages.UserUnmuted, target.GetTag());
var description = $"- {string.Format(Messages.DescriptionActionReason, reason)}";
var description = string.Format(Messages.DescriptionActionReason, reason).AddBulletPoint();
var logResult = _utility.LogActionAsync(
data.Settings, channelId, executor, title, description, target, ColorsList.Green, ct: ct);
if (!logResult.IsSuccess)

View file

@ -138,9 +138,9 @@ public class SettingsCommandGroup : CommandGroup
var optionName = AllOptions[i].Name;
var optionValue = AllOptions[i].Display(cfg);
description.AppendLine($"- {$"Settings{optionName}".Localized()}")
.Append($" - {Markdown.InlineCode(optionName)}: ")
.AppendLine(optionValue);
description.AppendBulletPointLine($"Settings{optionName}".Localized())
.AppendSubBulletPoint(Markdown.InlineCode(optionName))
.Append(": ").AppendLine(optionValue);
}
var embed = new EmbedBuilder().WithSmallTitle(Messages.SettingsListTitle, bot)

View file

@ -9,6 +9,11 @@ public static class StringBuilderExtensions
return builder.Append("- ").Append(text);
}
public static StringBuilder AppendSubBulletPoint(this StringBuilder builder, string? text)
{
return builder.Append(" - ").Append(text);
}
public static StringBuilder AppendBulletPointLine(this StringBuilder builder, string? text)
{
return builder.Append("- ").AppendLine(text);

View file

@ -63,4 +63,9 @@ public static class StringExtensions
{
return WebUtility.UrlEncode(s).Replace('+', ' ');
}
public static string AddBulletPoint(this string s)
{
return $"- {s}";
}
}