Fix chat logging and !longhelp permission
This commit is contained in:
@@ -17,7 +17,6 @@ using Torch.API.Session;
|
|||||||
using Torch.Commands.Permissions;
|
using Torch.Commands.Permissions;
|
||||||
using Torch.Managers;
|
using Torch.Managers;
|
||||||
using VRage.Game.ModAPI;
|
using VRage.Game.ModAPI;
|
||||||
using Log = NLog.Fluent.Log;
|
|
||||||
|
|
||||||
namespace Torch.Commands
|
namespace Torch.Commands
|
||||||
{
|
{
|
||||||
@@ -68,11 +67,12 @@ namespace Torch.Commands
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Context.Respond(
|
Context.Respond(
|
||||||
$"Use the {commandManager.Prefix}longhelp command and check your Comms menu for a full list of commands.");
|
$"Command not found. Use the {commandManager.Prefix}longhelp command and check your Comms menu for a full list of commands.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("longhelp", "Get verbose help. Will send a long message, check the Comms tab.")]
|
[Command("longhelp", "Get verbose help. Will send a long message, check the Comms tab.")]
|
||||||
|
[Permission(MyPromoteLevel.None)]
|
||||||
public void LongHelp()
|
public void LongHelp()
|
||||||
{
|
{
|
||||||
var commandManager = Context.Torch.CurrentSession?.Managers.GetManager<CommandManager>();
|
var commandManager = Context.Torch.CurrentSession?.Managers.GetManager<CommandManager>();
|
||||||
|
@@ -26,6 +26,7 @@ namespace Torch.Managers.ChatManager
|
|||||||
private INetworkManager _networkManager;
|
private INetworkManager _networkManager;
|
||||||
|
|
||||||
private static readonly Logger _log = LogManager.GetCurrentClassLogger();
|
private static readonly Logger _log = LogManager.GetCurrentClassLogger();
|
||||||
|
private static readonly Logger _chatLog = LogManager.GetLogger("Chat");
|
||||||
|
|
||||||
private readonly ChatIntercept _chatIntercept;
|
private readonly ChatIntercept _chatIntercept;
|
||||||
|
|
||||||
@@ -93,6 +94,7 @@ namespace Torch.Managers.ChatManager
|
|||||||
Font = font,
|
Font = font,
|
||||||
Target = Sync.Players.TryGetIdentityId(targetSteamId)
|
Target = Sync.Players.TryGetIdentityId(targetSteamId)
|
||||||
};
|
};
|
||||||
|
_chatLog.Info($"{author} (to {GetMemberName(targetSteamId)}): {message}");
|
||||||
MyMultiplayerBase.SendScriptedChatMessage(ref scripted);
|
MyMultiplayerBase.SendScriptedChatMessage(ref scripted);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,10 +158,16 @@ namespace Torch.Managers.ChatManager
|
|||||||
|
|
||||||
internal void RaiseMessageRecieved(ChatMsg message, ref bool consumed)
|
internal void RaiseMessageRecieved(ChatMsg message, ref bool consumed)
|
||||||
{
|
{
|
||||||
var torchMsg =
|
var torchMsg = new TorchChatMessage(GetMemberName(message.Author), message.Author, message.Text);
|
||||||
new TorchChatMessage(MyMultiplayer.Static?.GetMemberName(message.Author) ?? $"user_{message.Author}",
|
|
||||||
message.Author, message.Text);
|
|
||||||
MessageProcessing?.Invoke(torchMsg, ref consumed);
|
MessageProcessing?.Invoke(torchMsg, ref consumed);
|
||||||
|
|
||||||
|
if (!consumed)
|
||||||
|
_chatLog.Info($"{torchMsg.Author}: {torchMsg.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetMemberName(ulong steamId)
|
||||||
|
{
|
||||||
|
return MyMultiplayer.Static?.GetMemberName(steamId) ?? $"user_{steamId}";
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class ChatIntercept : NetworkHandlerBase, INetworkHandler
|
internal class ChatIntercept : NetworkHandlerBase, INetworkHandler
|
||||||
|
Reference in New Issue
Block a user