mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-12 08:40:11 +00:00
feat: add "today" argument to pk;m birthday (#398)
This commit is contained in:
parent
f897ce5a45
commit
e0c43a9af7
3 changed files with 10 additions and 3 deletions
|
|
@ -6,6 +6,7 @@ using System.Net.Http;
|
|||
using Myriad.Builders;
|
||||
|
||||
using NodaTime;
|
||||
using NodaTime.Extensions;
|
||||
|
||||
using PluralKit.Core;
|
||||
|
||||
|
|
@ -288,7 +289,13 @@ namespace PluralKit.Bot
|
|||
ctx.CheckOwnMember(target);
|
||||
|
||||
var birthdayStr = ctx.RemainderOrNull();
|
||||
var birthday = DateUtils.ParseDate(birthdayStr, true);
|
||||
|
||||
LocalDate? birthday;
|
||||
if (birthdayStr == "today" || birthdayStr == "now")
|
||||
birthday = SystemClock.Instance.InZone(ctx.System.Zone).GetCurrentDate();
|
||||
else
|
||||
birthday = DateUtils.ParseDate(birthdayStr, true);
|
||||
|
||||
if (birthday == null) throw Errors.BirthdayParseError(birthdayStr);
|
||||
|
||||
var patch = new MemberPatch { Birthday = Partial<LocalDate?>.Present(birthday) };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue