1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-29 02:29:55 +03:00

Add /clear command

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-07-01 16:45:50 +05:00
parent 2265364b52
commit 17c43be878
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
11 changed files with 169 additions and 19 deletions

View file

@ -15,7 +15,7 @@ namespace Boyfriend;
public static class Extensions {
/// <summary>
/// Adds a footer with the <paramref name="user" />'s avatar and tag (username#0000).
/// Adds a footer with the <paramref name="user" />'s avatar and tag (@username or username#0000).
/// </summary>
/// <param name="builder">The builder to add the footer to.</param>
/// <param name="user">The user whose tag and avatar to add.</param>
@ -120,10 +120,20 @@ public static class Extensions {
/// </summary>
/// <param name="s">The string to sanitize.</param>
/// <returns>The sanitized string that can be safely used in <see cref="Markdown.BlockCode(string)" />.</returns>
public static string SanitizeForBlockCode(this string s) {
private static string SanitizeForBlockCode(this string s) {
return s.Replace("```", "```");
}
/// <summary>
/// Sanitizes a string (see <see cref="SanitizeForBlockCode" />) and formats the string with block code.
/// </summary>
/// <param name="s">The string to sanitize and format.</param>
/// <returns>The sanitized string formatted with <see cref="Markdown.BlockCode(string)" />.</returns>
public static string InBlockCode(this string s) {
s = s.SanitizeForBlockCode();
return $"```{s.SanitizeForBlockCode()}{(s.EndsWith("`") || string.IsNullOrWhiteSpace(s) ? " " : "")}```";
}
public static string Localized(this string key) {
return Messages.ResourceManager.GetString(key, Messages.Culture) ?? key;
}