Finished new response system

This commit is contained in:
Kwoth
2024-05-02 06:47:01 +00:00
parent a25adefc65
commit fc4858830c
102 changed files with 1811 additions and 1818 deletions

View File

@@ -9,18 +9,25 @@ namespace NadekoBot.Extensions;
public static class Extensions
{
private static readonly Regex _urlRegex =
new(@"^(https?|ftp)://(?<path>[^\s/$.?#].[^\s]*)$", RegexOptions.Compiled);
/// <summary>
/// Converts <see cref="DateTime"/> to <see cref="DateOnly"/>
/// </summary>
/// <param name="dateTime"> The <see cref="DateTime"/> to convert. </param>
/// <returns> The <see cref="DateOnly"/>. </returns>
public static DateOnly ToDateOnly(this DateTime dateTime)
=> DateOnly.FromDateTime(dateTime);
/// <summary>
/// Determines if <see cref="DateTime"/> is before today
/// </summary>
/// <param name="date"> The <see cref="DateTime"/> to check. </param>
/// <returns> True if <see cref="DateTime"/> is before today. </returns>
public static bool IsBeforeToday(this DateTime date)
=> date < DateTime.UtcNow.Date;
private static readonly Regex _urlRegex =
new(@"^(https?|ftp)://(?<path>[^\s/$.?#].[^\s]*)$", RegexOptions.Compiled);
// public static EmbedBuilder WithAuthor(this EmbedBuilder eb, IUser author)
// => eb.WithAuthor(author.ToString()!, author.RealAvatarUrl().ToString());
public static Task EditAsync(this IUserMessage msg, SmartText text)
=> text switch
{