From 80b0330ad2c50a9a2e7cbe34d7d8403f4fb47d3e Mon Sep 17 00:00:00 2001 From: zznty <94796179+zznty@users.noreply.github.com> Date: Thu, 28 Jul 2022 20:01:19 +0700 Subject: [PATCH] make chat message author optional --- TorchRemote.Models/Requests/ChatMessageRequest.cs | 2 +- TorchRemote.Plugin/Controllers/ChatController.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TorchRemote.Models/Requests/ChatMessageRequest.cs b/TorchRemote.Models/Requests/ChatMessageRequest.cs index c8c8a3e..e7a0a5c 100644 --- a/TorchRemote.Models/Requests/ChatMessageRequest.cs +++ b/TorchRemote.Models/Requests/ChatMessageRequest.cs @@ -1,4 +1,4 @@ using TorchRemote.Models.Shared; namespace TorchRemote.Models.Requests; -public record ChatMessageRequest(string Author, string Message, ChatChannel Channel, long? TargetId = null); \ No newline at end of file +public record ChatMessageRequest(string? Author, string Message, ChatChannel Channel, long? TargetId = null); \ No newline at end of file diff --git a/TorchRemote.Plugin/Controllers/ChatController.cs b/TorchRemote.Plugin/Controllers/ChatController.cs index 76f46fb..25ad5c3 100644 --- a/TorchRemote.Plugin/Controllers/ChatController.cs +++ b/TorchRemote.Plugin/Controllers/ChatController.cs @@ -40,7 +40,7 @@ public class ChatController : WebApiController, IChatController var msg = new ChatMsg { - CustomAuthorName = request.Author, + CustomAuthorName = request.Author ?? Statics.Torch.Config.ChatName, Text = request.Message, Channel = (byte)request.Channel, TargetId = request.TargetId.GetValueOrDefault()