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-01 16:49:43 -08:00
|
|
|
using Robust.Shared.Console;
|
2020-12-03 03:40:47 +01:00
|
|
|
|
2021-06-09 22:19:39 +02:00
|
|
|
namespace Content.Server.Chat.Commands
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
2024-04-27 14:17:46 +03:00
|
|
|
[AdminCommand(AdminFlags.Adminchat)]
|
2025-06-18 20:03:28 -04:00
|
|
|
internal sealed class AdminChatCommand : LocalizedCommands
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
2025-06-18 20:03:28 -04:00
|
|
|
[Dependency] private readonly IChatManager _chatManager = default!;
|
2020-12-03 03:40:47 +01:00
|
|
|
|
2025-06-18 20:03:28 -04:00
|
|
|
public override string Command => "asay";
|
|
|
|
|
|
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
2020-12-03 03:40:47 +01:00
|
|
|
{
|
2023-10-28 09:59:53 +11:00
|
|
|
var player = shell.Player;
|
2021-03-16 15:50:20 +01:00
|
|
|
|
|
|
|
|
if (player == null)
|
|
|
|
|
{
|
2025-06-18 20:03:28 -04:00
|
|
|
shell.WriteError(Loc.GetString($"shell-cannot-run-command-from-server"));
|
2021-03-16 15:50:20 +01:00
|
|
|
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;
|
|
|
|
|
|
2025-06-18 20:03:28 -04:00
|
|
|
_chatManager.TrySendOOCMessage(player, message, OOCChatType.Admin);
|
2020-12-03 03:40:47 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|