[feat] SlangSatinization
# Conflicts: # Content.Server/Chat/Systems/ChatSystem.cs
This commit is contained in:
36
Content.Server/Chat/Commands/SlangSanitizationCommand.cs
Normal file
36
Content.Server/Chat/Commands/SlangSanitizationCommand.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Content.Server.Administration;
|
||||
using Content.Server.Chat.Managers;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.White;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Server.Chat.Commands;
|
||||
|
||||
[AdminCommand(AdminFlags.Admin)]
|
||||
public sealed class SlangSanitizationCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "enableSlangSanitization";
|
||||
public string Description => "Toggles the slang sanitization.";
|
||||
public string Help => "enableSlangSanitization <bool>";
|
||||
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1 || !bool.TryParse(args[0], out bool value))
|
||||
{
|
||||
shell.WriteError($"{args[0]} is not a valid boolean.");
|
||||
return;
|
||||
}
|
||||
|
||||
_cfg.SetCVar(WhiteCVars.ChatSlangFilter, value);
|
||||
|
||||
var announce = Loc.GetString("chatsan-announce-slang-sanitization",
|
||||
("admin", $"{shell.Player?.Name}"),
|
||||
("value", $"{value}"));
|
||||
|
||||
IoCManager.Resolve<IChatManager>().DispatchServerAnnouncement(announce, Color.Red);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user