make chat message author optional

This commit is contained in:
zznty
2022-07-28 20:01:19 +07:00
parent cdd26c55a9
commit 80b0330ad2
2 changed files with 2 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
using TorchRemote.Models.Shared; using TorchRemote.Models.Shared;
namespace TorchRemote.Models.Requests; namespace TorchRemote.Models.Requests;
public record ChatMessageRequest(string Author, string Message, ChatChannel Channel, long? TargetId = null); public record ChatMessageRequest(string? Author, string Message, ChatChannel Channel, long? TargetId = null);

View File

@@ -40,7 +40,7 @@ public class ChatController : WebApiController, IChatController
var msg = new ChatMsg var msg = new ChatMsg
{ {
CustomAuthorName = request.Author, CustomAuthorName = request.Author ?? Statics.Torch.Config.ChatName,
Text = request.Message, Text = request.Message,
Channel = (byte)request.Channel, Channel = (byte)request.Channel,
TargetId = request.TargetId.GetValueOrDefault() TargetId = request.TargetId.GetValueOrDefault()