namespace AnsonBot.Core;

public static class Humanize
{
    /// <summary>Formats a duration as "2h 15m", "45m", or "just joined".</summary>
    public static string Duration(TimeSpan d)
    {
        if (d.TotalMinutes < 1) return "just joined";

        var hours = (int)d.TotalHours;
        var minutes = d.Minutes;

        return hours > 0 ? $"{hours}h {minutes}m" : $"{minutes}m";
    }
}
