Files
tbd-station-14/Content.Server/Announcements/AnnounceCommand.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

38 lines
1.3 KiB
C#

using Content.Server.Administration;
using Content.Server.Chat;
using Content.Server.Chat.Systems;
using Content.Shared.Administration;
using Robust.Shared.Console;
namespace Content.Server.Announcements
{
[AdminCommand(AdminFlags.Moderator)]
public sealed class AnnounceCommand : IConsoleCommand
{
public string Command => "announce";
public string Description => "Send an in-game announcement.";
public string Help => $"{Command} <sender> <message> or {Command} <message> to send announcement as CentCom.";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var chat = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>();
if (args.Length == 0)
{
shell.WriteError("Not enough arguments! Need at least 1.");
return;
}
if (args.Length == 1)
{
chat.DispatchGlobalAnnouncement(args[0], colorOverride: Color.Gold);
}
else
{
var message = string.Join(' ', new ArraySegment<string>(args, 1, args.Length-1));
chat.DispatchGlobalAnnouncement(message, args[0], colorOverride: Color.Gold);
}
shell.WriteLine("Sent!");
}
}
}