Files
OldThink/Content.Server/_White/Commands/NoticeCommand.cs

44 lines
1.3 KiB
C#

using Content.Server.Chat.Managers;
using Content.Shared.Administration;
using Content.Shared.Chat;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.Enums;
namespace Content.Server._White.Commands;
[AnyCommand]
internal sealed class NoticeCommand : IConsoleCommand
{
public string Command => "notice";
public string Description => "Send a chat message to self.";
public string Help => "notice <text>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not { } player)
{
shell.WriteError("This command cannot be run from the server.");
return;
}
if (player.Status != SessionStatus.InGame)
return;
if (player.AttachedEntity is not { } playerEntity)
{
//shell.WriteError("You don't have an entity!"); By HitPanda: Breaks test
return;
}
if (args.Length < 1)
return;
var message = string.Join(" ", args).Trim();
if (string.IsNullOrEmpty(message))
return;
IoCManager.Resolve<IChatManager>().ChatMessageToOne(ChatChannel.Emotes, message, message, EntityUid.Invalid, false, player.ConnectedClient, recordReplay: false);
}
}