tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
ChatUser.cs
Go to the documentation of this file.
1using System;
2using System.Globalization;
3
4using Newtonsoft.Json;
5
7{
11 public sealed class ChatUser
12 {
16 public string Id { get; private set; }
17
21 [JsonIgnore]
22 public ulong RealId
23 {
24 get => UInt64.Parse(Id!, CultureInfo.InvariantCulture);
25 private set => Id = value.ToString(CultureInfo.InvariantCulture);
26 }
27
31 public string FriendlyName { get; }
32
36 public string Mention { get; }
37
42
50 public ChatUser(ChannelRepresentation channel, string friendlyName, string mention, ulong realId)
51 {
52 Channel = channel ?? throw new ArgumentNullException(nameof(channel));
53 FriendlyName = friendlyName ?? throw new ArgumentNullException(nameof(friendlyName));
54 Mention = mention ?? throw new ArgumentNullException(nameof(mention));
55
56 Id = null!;
57 RealId = realId;
58 }
59 }
60}
Represents a tgs_chat_user datum.
Definition ChatUser.cs:12
string Id
Backing field for RealId. Represented as a string to avoid BYOND percision loss.
Definition ChatUser.cs:16
string Mention
The text to mention the user.
Definition ChatUser.cs:36
ChatUser(ChannelRepresentation channel, string friendlyName, string mention, ulong realId)
Initializes a new instance of the ChatUser class.
Definition ChatUser.cs:50
string FriendlyName
The friendly name of the user.
Definition ChatUser.cs:31
ChannelRepresentation Channel
The ChannelRepresentation the user spoke from.
Definition ChatUser.cs:41