From bdbed1e6656396351b62f035c61408fd07440ab1 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Mon, 4 Jul 2022 07:34:16 +1000 Subject: [PATCH] Allow adminnotes to use username (#9388) No I'm not going to the ban panel to find someone's GUID. --- .../Commands/OpenAdminNotesCommand.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Content.Server/Administration/Commands/OpenAdminNotesCommand.cs b/Content.Server/Administration/Commands/OpenAdminNotesCommand.cs index 574c710fa8..50442c243f 100644 --- a/Content.Server/Administration/Commands/OpenAdminNotesCommand.cs +++ b/Content.Server/Administration/Commands/OpenAdminNotesCommand.cs @@ -1,4 +1,5 @@ using Content.Server.Administration.Notes; +using Content.Server.Database; using Content.Shared.Administration; using Robust.Server.Player; using Robust.Shared.Console; @@ -12,7 +13,7 @@ public sealed class OpenAdminNotesCommand : IConsoleCommand public string Command => CommandName; public string Description => "Opens the admin notes panel."; - public string Help => $"Usage: {Command} "; + public string Help => $"Usage: {Command} "; public async void Execute(IConsoleShell shell, string argStr, string[] args) { @@ -28,6 +29,18 @@ public sealed class OpenAdminNotesCommand : IConsoleCommand { case 1 when Guid.TryParse(args[0], out notedPlayer): break; + case 1: + var db = IoCManager.Resolve(); + var dbGuid = await db.GetAssignedUserIdAsync(args[0]); + + if (dbGuid == null) + { + shell.WriteError($"Unable to find {args[0]} netuserid"); + return; + } + + notedPlayer = dbGuid.Value; + break; default: shell.WriteError($"Invalid arguments.\n{Help}"); return;