forked from SoDOff-Project/sodoff-mmo
Moderation Commands #1
@ -12,9 +12,13 @@ class BanCommand : IManagementCommand
|
|||||||
{
|
{
|
||||||
if(arguments.Length < 2) { client.Send(Utils.BuildServerSideMessage($"Expected 3 Args, Got {arguments.Length + 1}", "Server")); return; }
|
if(arguments.Length < 2) { client.Send(Utils.BuildServerSideMessage($"Expected 3 Args, Got {arguments.Length + 1}", "Server")); return; }
|
||||||
|
|
||||||
|
if (arguments[0] == "help") client.Send(Utils.BuildServerSideMessage($"::ban - This bans a user who is in-room. First argument is the id of the user in-room. Room user lists start at 0.", "Server"));
|
||||||
|
var clientToBan = client.Room!.Clients.ToArray()[int.Parse(arguments[0])].PlayerData.Uid;
|
||||||
|
if (clientToBan == null) { client.Send(Utils.BuildServerSideMessage($"User Could Not Be Found", "Server")); return; }
|
||||||
|
|
||||||
// send an http request to the api set in appsettings
|
// send an http request to the api set in appsettings
|
||||||
ApiWebService apiWebService = new();
|
ApiWebService apiWebService = new();
|
||||||
var response = apiWebService.BanUser(client, arguments[0], arguments[1], arguments[2]);
|
var response = apiWebService.BanUser(client, clientToBan, arguments[1], arguments[2]);
|
||||||
var responseString = response.Content.ReadAsStringAsync().Result;
|
var responseString = response.Content.ReadAsStringAsync().Result;
|
||||||
|
|
||||||
if (response.StatusCode != System.Net.HttpStatusCode.OK && responseString != null) { client.Send(Utils.BuildServerSideMessage(responseString, "Server")); return; }
|
if (response.StatusCode != System.Net.HttpStatusCode.OK && responseString != null) { client.Send(Utils.BuildServerSideMessage(responseString, "Server")); return; }
|
||||||
|
@ -63,7 +63,7 @@
|
|||||||
"// Authentication Required": "authentication is required to connect to mmo",
|
"// Authentication Required": "authentication is required to connect to mmo",
|
||||||
"Authentication": "Required",
|
"Authentication": "Required",
|
||||||
|
|
||||||
"// ApiUrl": "SoDOff API server URL for authentication calls",
|
"// ApiUrl": "SoDOff API server URL for authentication calls and other calls",
|
||||||
"ApiUrl": "http://localhost:5000",
|
"ApiUrl": "http://localhost:5000",
|
||||||
|
|
||||||
"// BypassToken": "Token allowed to connect without authentication",
|
"// BypassToken": "Token allowed to connect without authentication",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user