Whitelist shell feedback (#10694)

Co-authored-by: Visne <39844191+Visne@users.noreply.github.com>
This commit is contained in:
metalgearsloth
2022-08-19 16:42:47 +10:00
committed by GitHub
parent 86d7a1fbb9
commit 9ec4b0867e
2 changed files with 20 additions and 0 deletions

View File

@@ -31,10 +31,17 @@ public sealed class AddWhitelistCommand : IConsoleCommand
var guid = data.UserId;
var isWhitelisted = await db.GetWhitelistStatusAsync(guid);
if (isWhitelisted)
{
shell.WriteLine(Loc.GetString("command-whitelistadd-existing", ("username", data.Username)));
return;
}
await db.AddToWhitelistAsync(guid);
shell.WriteLine(Loc.GetString("command-whitelistadd-added", ("username", data.Username)));
return;
}
shell.WriteError(Loc.GetString("command-whitelistadd-not-found", ("username", args[0])));
}
}
@@ -60,10 +67,17 @@ public sealed class RemoveWhitelistCommand : IConsoleCommand
var guid = data.UserId;
var isWhitelisted = await db.GetWhitelistStatusAsync(guid);
if (!isWhitelisted)
{
shell.WriteLine(Loc.GetString("command-whitelistremove-existing", ("username", data.Username)));
return;
}
await db.RemoveFromWhitelistAsync(guid);
shell.WriteLine(Loc.GetString("command-whitelistremove-removed", ("username", data.Username)));
return;
}
shell.WriteError(Loc.GetString("command-whitelistremove-not-found", ("username", args[0])));
}
}