2021-03-17 15:43:31 +01:00
|
|
|
using Content.Server.Administration;
|
2022-06-03 21:37:35 +10:00
|
|
|
using Content.Server.Chat;
|
2022-06-23 20:11:03 +10:00
|
|
|
using Content.Server.Chat.Systems;
|
2021-03-17 15:43:31 +01:00
|
|
|
using Content.Shared.Administration;
|
|
|
|
|
using Robust.Shared.Console;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Announcements
|
2021-03-17 15:43:31 +01:00
|
|
|
{
|
2024-06-01 04:14:43 -04:00
|
|
|
[AdminCommand(AdminFlags.Moderator)]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class AnnounceCommand : IConsoleCommand
|
2021-03-17 15:43:31 +01:00
|
|
|
{
|
|
|
|
|
public string Command => "announce";
|
|
|
|
|
public string Description => "Send an in-game announcement.";
|
2022-07-20 04:08:24 +00:00
|
|
|
public string Help => $"{Command} <sender> <message> or {Command} <message> to send announcement as CentCom.";
|
2021-03-17 15:43:31 +01:00
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
|
|
|
{
|
2022-06-03 21:37:35 +10:00
|
|
|
var chat = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<ChatSystem>();
|
2021-03-17 15:43:31 +01:00
|
|
|
|
|
|
|
|
if (args.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
shell.WriteError("Not enough arguments! Need at least 1.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (args.Length == 1)
|
|
|
|
|
{
|
2022-07-04 16:00:51 +10:00
|
|
|
chat.DispatchGlobalAnnouncement(args[0], colorOverride: Color.Gold);
|
2021-03-17 15:43:31 +01:00
|
|
|
}
|
2021-11-22 22:34:48 +00:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var message = string.Join(' ', new ArraySegment<string>(args, 1, args.Length-1));
|
2022-07-04 16:00:51 +10:00
|
|
|
chat.DispatchGlobalAnnouncement(message, args[0], colorOverride: Color.Gold);
|
2021-11-22 22:34:48 +00:00
|
|
|
}
|
2021-03-17 15:43:31 +01:00
|
|
|
shell.WriteLine("Sent!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|