feat: add "today" argument to pk;m birthday (#398)

This commit is contained in:
Spectralitree 2021-10-29 17:44:51 -04:00 committed by spiral
parent f897ce5a45
commit e0c43a9af7
No known key found for this signature in database
GPG Key ID: A6059F0CA0E1BD31
3 changed files with 10 additions and 3 deletions

View File

@ -37,7 +37,7 @@ namespace PluralKit.Bot
public static Command MemberDesc = new Command("member description", "member <member> description [description]", "Changes a member's description"); public static Command MemberDesc = new Command("member description", "member <member> description [description]", "Changes a member's description");
public static Command MemberPronouns = new Command("member pronouns", "member <member> pronouns [pronouns]", "Changes a member's pronouns"); public static Command MemberPronouns = new Command("member pronouns", "member <member> pronouns [pronouns]", "Changes a member's pronouns");
public static Command MemberColor = new Command("member color", "member <member> color [color]", "Changes a member's color"); public static Command MemberColor = new Command("member color", "member <member> color [color]", "Changes a member's color");
public static Command MemberBirthday = new Command("member birthday", "member <member> birthday [birthday]", "Changes a member's birthday"); public static Command MemberBirthday = new Command("member birthday", "member <member> birthday [birthday|today]", "Changes a member's birthday");
public static Command MemberProxy = new Command("member proxy", "member <member> proxy [add|remove] [example proxy]", "Changes, adds, or removes a member's proxy tags"); public static Command MemberProxy = new Command("member proxy", "member <member> proxy [add|remove] [example proxy]", "Changes, adds, or removes a member's proxy tags");
public static Command MemberDelete = new Command("member delete", "member <member> delete", "Deletes a member"); public static Command MemberDelete = new Command("member delete", "member <member> delete", "Deletes a member");
public static Command MemberBannerImage = new Command("member banner", "member <member> banner [url]", "Set the member's banner image"); public static Command MemberBannerImage = new Command("member banner", "member <member> banner [url]", "Set the member's banner image");

View File

@ -6,6 +6,7 @@ using System.Net.Http;
using Myriad.Builders; using Myriad.Builders;
using NodaTime; using NodaTime;
using NodaTime.Extensions;
using PluralKit.Core; using PluralKit.Core;
@ -288,7 +289,13 @@ namespace PluralKit.Bot
ctx.CheckOwnMember(target); ctx.CheckOwnMember(target);
var birthdayStr = ctx.RemainderOrNull(); 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); if (birthday == null) throw Errors.BirthdayParseError(birthdayStr);
var patch = new MemberPatch { Birthday = Partial<LocalDate?>.Present(birthday) }; var patch = new MemberPatch { Birthday = Partial<LocalDate?>.Present(birthday) };

View File

@ -77,7 +77,7 @@ Some arguments indicate the use of specific Discord features. These include:
- `pk;member <member> keepproxy [on|off]` - Sets whether to include a member's proxy tags in the proxied message. - `pk;member <member> keepproxy [on|off]` - Sets whether to include a member's proxy tags in the proxied message.
- `pk;member <member> pronouns [pronouns]` - Changes the pronouns of a member. - `pk;member <member> pronouns [pronouns]` - Changes the pronouns of a member.
- `pk;member <member> color [color]` - Changes the color of a member. - `pk;member <member> color [color]` - Changes the color of a member.
- `pk;member <member> birthdate [birthdate]` - Changes the birthday of a member. - `pk;member <member> birthdate [birthdate|today]` - Changes the birthday of a member.
- `pk;member <member> delete` - Deletes a member. - `pk;member <member> delete` - Deletes a member.
## Group commands ## Group commands