forked from SoDOff-Project/sodoff-mmo
Moderation Commands #1
@ -1,4 +1,6 @@
|
||||
using sodoffmmo.Attributes;
|
||||
using System.Net;
|
||||
using System.Net.Http.Json;
|
||||
using sodoffmmo.Attributes;
|
||||
using sodoffmmo.Core;
|
||||
using sodoffmmo.Data;
|
||||
using sodoffmmo.Management;
|
||||
@ -37,6 +39,21 @@ class ChatMessageHandler : CommandHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
// send an http request to api to check for 'IndefiniteOpenChatBan' or 'TemporaryOpenChatBan'
|
||||
HttpClient httpClient = new();
|
||||
var content = new FormUrlEncodedContent(
|
||||
new Dictionary<string, string> {
|
||||
{ "token", client.PlayerData.UNToken }
|
||||
}
|
||||
);
|
||||
|
||||
httpClient.Timeout = new TimeSpan(0, 0, 3);
|
||||
var response = httpClient.PostAsync($"{Configuration.ServerConfiguration.ApiUrl}/Moderation/CheckForVikingBan", content).Result;
|
||||
UserBanType? banType = response.Content.ReadFromJsonAsync<UserBanType>().Result;
|
||||
|
||||
if (banType != null && (banType == UserBanType.IndefiniteOpenChatBan || banType == UserBanType.TemporaryOpenChatBan))
|
||||
{ client.Send(Utils.ArrNetworkPacket(new string[] { "CB", "-1", "1" }, "CB")); return; }
|
||||
|
||||
client.Room.Send(Utils.BuildChatMessage(client.PlayerData.Uid, message, client.PlayerData.DiplayName), client);
|
||||
|
||||
NetworkObject cmd = new();
|
||||
|
10
src/Core/UserBanType.cs
Normal file
10
src/Core/UserBanType.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace sodoffmmo.Core;
|
||||
|
||||
public enum UserBanType
|
||||
{
|
||||
NotBanned = 0,
|
||||
IndefiniteOpenChatBan = 1,
|
||||
TemporaryOpenChatBan = 2,
|
||||
IndefiniteAccountBan = 3,
|
||||
TemporaryAccountBan = 4
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user