add command: `ban list`

To show the current ban list settings.
This commit is contained in:
Robin C. Ladiges 2023-03-22 21:57:11 +01:00
parent 3ac1c1bc26
commit 6bbce7a52a
No known key found for this signature in database
GPG Key ID: B494D3DF92661B99
1 changed files with 21 additions and 2 deletions

View File

@ -148,7 +148,7 @@ public static class BanLists {
public static string HandleBanCommand(string[] args, MUCH much) {
if (args.Length == 0) {
return "Usage: ban {enable|disable|player|profile|ip} ...";
return "Usage: ban {list|enable|disable|player|profile|ip} ...";
}
string cmd = args[0];
@ -156,7 +156,26 @@ public static class BanLists {
switch (cmd) {
default:
return "Usage: ban {enable|disable|player|profile|ip} ...";
return "Usage: ban {list|enable|disable|player|profile|ip} ...";
case "list":
if (args.Length != 0) {
return "Usage: ban list";
}
StringBuilder list = new StringBuilder();
list.Append("BanList: " + (Enabled ? "enabled" : "disabled"));
if (IPs.Count > 0) {
list.Append("\nBanned IPv4 addresses:\n- ");
list.Append(string.Join("\n- ", IPs));
}
if (Profiles.Count > 0) {
list.Append("\nBanned profile IDs:\n- ");
list.Append(string.Join("\n- ", Profiles));
}
return list.ToString();
case "enable":
if (args.Length != 0) {