2020-12-03 03:40:47 +01:00
|
|
|
using Content.Server.Administration;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Server.Chat.Managers;
|
2020-12-03 03:40:47 +01:00
|
|
|
using Content.Shared.Administration;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Server.Player;
|
2021-02-01 16:49:43 -08:00
|
|
|
using Robust.Shared.Console;
|
2020-12-03 03:40:47 +01:00
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Chat.Commands
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
|
|
|
|
[AdminCommand(AdminFlags.Admin)]
|
2022-02-16 00:23:23 -07:00
|
|
|
internal sealed class AdminChatCommand : IConsoleCommand
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
|
|
|
|
public string Command => "asay";
|
|
|
|
|
public string Description => "Send chat messages to the private admin chat channel.";
|
|
|
|
|
public string Help => "asay <text>";
|
|
|
|
|
|
2021-02-01 16:49:43 -08:00
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
2021-03-16 15:50:20 +01:00
|
|
|
var player = (IPlayerSession?) shell.Player;
|
|
|
|
|
|
|
|
|
|
if (player == null)
|
|
|
|
|
{
|
|
|
|
|
shell.WriteError("You can't run this command locally.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-03 03:40:47 +01:00
|
|
|
if (args.Length < 1)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var message = string.Join(" ", args).Trim();
|
|
|
|
|
if (string.IsNullOrEmpty(message))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var chat = IoCManager.Resolve<IChatManager>();
|
|
|
|
|
chat.SendAdminChat(player, message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|