mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat: initial 6-character HID rework
This commit is contained in:
parent
73f43b8cb3
commit
9f56697241
30 changed files with 208 additions and 91 deletions
|
|
@ -29,9 +29,9 @@ public class Admin
|
|||
if (target == null)
|
||||
throw new PKError("Unknown system.");
|
||||
|
||||
var newHid = ctx.PopArgument();
|
||||
if (!Regex.IsMatch(newHid, "^[a-z]{5}$"))
|
||||
throw new PKError($"Invalid new system ID `{newHid}`.");
|
||||
var input = ctx.PopArgument();
|
||||
if (!input.TryParseHid(out var newHid))
|
||||
throw new PKError($"Invalid new system ID `{input}`.");
|
||||
|
||||
var existingSystem = await ctx.Repository.GetSystemByHid(newHid);
|
||||
if (existingSystem != null)
|
||||
|
|
@ -52,9 +52,9 @@ public class Admin
|
|||
if (target == null)
|
||||
throw new PKError("Unknown member.");
|
||||
|
||||
var newHid = ctx.PopArgument();
|
||||
if (!Regex.IsMatch(newHid, "^[a-z]{5}$"))
|
||||
throw new PKError($"Invalid new member ID `{newHid}`.");
|
||||
var input = ctx.PopArgument();
|
||||
if (!input.TryParseHid(out var newHid))
|
||||
throw new PKError($"Invalid new member ID `{input}`.");
|
||||
|
||||
var existingMember = await ctx.Repository.GetMemberByHid(newHid);
|
||||
if (existingMember != null)
|
||||
|
|
@ -78,9 +78,9 @@ public class Admin
|
|||
if (target == null)
|
||||
throw new PKError("Unknown group.");
|
||||
|
||||
var newHid = ctx.PopArgument();
|
||||
if (!Regex.IsMatch(newHid, "^[a-z]{5}$"))
|
||||
throw new PKError($"Invalid new group ID `{newHid}`.");
|
||||
var input = ctx.PopArgument();
|
||||
if (!input.TryParseHid(out var newHid))
|
||||
throw new PKError($"Invalid new group ID `{input}`.");
|
||||
|
||||
var existingGroup = await ctx.Repository.GetGroupByHid(newHid);
|
||||
if (existingGroup != null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue