mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 09:18:27 -04:00
33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
namespace NadekoBot.Modules.Patronage;
|
|
|
|
public static class PatronExtensions
|
|
{
|
|
public static string ToFullName(this PatronTier tier)
|
|
=> tier switch
|
|
{
|
|
_ => $"Patron Tier {tier}",
|
|
};
|
|
|
|
public static string ToFullName(this QuotaPer per)
|
|
=> per.Humanize(LetterCasing.LowerCase);
|
|
|
|
public static DateTime DayOfNextMonth(this DateTime date, int day)
|
|
{
|
|
var nextMonth = date.AddMonths(1);
|
|
var dt = DateTime.SpecifyKind(new(nextMonth.Year, nextMonth.Month, day), DateTimeKind.Utc);
|
|
return dt;
|
|
}
|
|
|
|
public static DateTime FirstOfNextMonth(this DateTime date)
|
|
=> date.DayOfNextMonth(1);
|
|
|
|
public static DateTime SecondOfNextMonth(this DateTime date)
|
|
=> date.DayOfNextMonth(2);
|
|
|
|
public static string ToShortAndRelativeTimestampTag(this DateTime date)
|
|
{
|
|
var fullResetStr = TimestampTag.FromDateTime(date, TimestampTagStyles.ShortDateTime);
|
|
var relativeResetStr = TimestampTag.FromDateTime(date, TimestampTagStyles.Relative);
|
|
return $"{fullResetStr}\n{relativeResetStr}";
|
|
}
|
|
} |