Files
tbd-station-14/Content.Server/Administration/Commands/DSay.cs
Nemanja 68992735d8 Clean up command perms (#28451)
* Change BanExemption command to AdminFlags.Ban permissions

* Change LOOC to check for Moderator permission

* Change ListVerbs from Admin to Debug AdminFlags

* Change RunVerbAs from Admin to Fun AdminFlags

* More permission changes

* Change GhostKick to Moderator perm

* Clean up command perms

* fuck

---------

Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
2024-06-01 01:14:43 -07:00

42 lines
1.2 KiB
C#

using Content.Server.Chat.Systems;
using Content.Shared.Administration;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands
{
[AdminCommand(AdminFlags.Moderator)]
sealed class DSay : IConsoleCommand
{
[Dependency] private readonly IEntityManager _e = default!;
public string Command => "dsay";
public string Description => Loc.GetString("dsay-command-description");
public string Help => Loc.GetString("dsay-command-help-text", ("command", Command));
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var player = shell.Player;
if (player == null)
{
shell.WriteLine("shell-only-players-can-run-this-command");
return;
}
if (player.AttachedEntity is not { Valid: true } entity)
return;
if (args.Length < 1)
return;
var message = string.Join(" ", args).Trim();
if (string.IsNullOrEmpty(message))
return;
var chat = _e.System<ChatSystem>();
chat.TrySendInGameOOCMessage(entity, message, InGameOOCChatType.Dead, false, shell, player);
}
}
}